home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / Disk-HOWTO < prev    next >
Text File  |  1997-11-14  |  166KB  |  3,558 lines

  1.   Linux Disk HOWTO
  2.   Stein Gjoen, sgjoen@nyx.net
  3.   v0.16d, 9 November 1997
  4.  
  5.   This document describes how best to use multiple disks and partitions
  6.   for a Linux system. Although some of this text is Linux specific the
  7.   general approach outlined here can be applied to many other multi
  8.   tasking operating systems.
  9.  
  10.   1.  Introduction
  11.  
  12.   In commemoration of recent legal development this brand new release is
  13.   code named the Trademark Resolution release.
  14.  
  15.   New code names will appear as per industry standard guidelines to
  16.   emphasize the state-of-the-art-ness of this document.
  17.  
  18.   This document was written for two reasons, mainly because I got hold
  19.   of 3 old SCSI disks to set up my Linux system on and I was pondering
  20.   how best to utilise the inherent possibilities of parallelizing in a
  21.   SCSI system. Secondly I hear there is a prize for people who write
  22.   documents...
  23.  
  24.   This is intended to be read in conjunction with the Linux Filesystem
  25.   Structure Standard (FSSTND). It does not in any way replace it but
  26.   tries to suggest where physically to place directories detailed in the
  27.   FSSTND, in terms of drives, partitions, types, RAID, file system (fs),
  28.   physical sizes and other parameters that should be considered and
  29.   tuned in a Linux system, ranging from single home systems to large
  30.   servers on the Internet.
  31.  
  32.   Even though it is now more than a year since last release of the
  33.   FSSTND work is still continuing, under a new name, and will encompass
  34.   more than Linux, fill in a few blanks hinted at in FSSTND version 1.2
  35.   as well as other general improvements. The development mailing list is
  36.   currently private but a general release is hopefully in the near
  37.   future. The new issue will be named Filesystem Hierarchy Standard
  38.   (FHS) and will cover more than Linux alone.
  39.  
  40.   It is also a good idea to read the Linux Installation guides
  41.   thoroughly and if you are using a PC system, which I guess the
  42.   majority still does, you can find much relevant and useful information
  43.   in the FAQs for the newsgroup comp.sys.ibm.pc.hardware especially for
  44.   storage media.
  45.  
  46.   This is also a learning experience for myself and I hope I can start
  47.   the ball rolling with this Mini-HOWTO and that it perhaps can evolve
  48.   into a larger more detailed and hopefully even more correct HOWTO.
  49.  
  50.   First of all we need a bit of legalese. Recent development shows it is
  51.   quite important.
  52.  
  53.   1.1.  Copyright
  54.  
  55.   This HOWTO is copyrighted 1996 Stein Gjoen.
  56.  
  57.   Unless otherwise stated, Linux HOWTO documents are copyrighted by
  58.   their respective authors. Linux HOWTO documents may be reproduced and
  59.   distributed in whole or in part, in any medium physical or electronic,
  60.   as long as this copyright notice is retained on all copies. Commercial
  61.   redistribution is allowed and encouraged; however, the author would
  62.   like to be notified of any such distributions.
  63.  
  64.   All translations, derivative works, or aggregate works incorporating
  65.   any Linux HOWTO documents must be covered under this copyright notice.
  66.   That is, you may not produce a derivative work from a HOWTO and impose
  67.   additional restrictions on its distribution. Exceptions to these rules
  68.   may be granted under certain conditions; please contact the Linux
  69.   HOWTO coordinator at the address given below.
  70.  
  71.   In short, we wish to promote dissemination of this information through
  72.   as many channels as possible. However, we do wish to retain copyright
  73.   on the HOWTO documents, and would like to be notified of any plans to
  74.   redistribute the HOWTOs.
  75.  
  76.   If you have questions, please contact Greg Hankins, the Linux HOWTO
  77.   coordinator, at gregh@sunsite.unc.edu via email.
  78.  
  79.   1.2.  Disclaimer
  80.  
  81.   Use the information in this document at your own risk. I disavow any
  82.   potential liability for the contents of this document. Use of the
  83.   concepts, examples, and/or other content of this document is entirely
  84.   at your own risk.
  85.  
  86.   All copyrights are owned by their owners, unless specifically noted
  87.   otherwise.  Use of a term in this document should not be regarded as
  88.   affecting the validity of any trademark or service mark.
  89.  
  90.   Naming of particular products or brands should not be seen as
  91.   endorsements.
  92.  
  93.   You are strongly recommended to take a backup of your system before
  94.   major installation and backups at regular intervals.
  95.  
  96.   1.3.  News
  97.  
  98.   The most recent addition is a new section on how best to get help
  99.   should you find yourself unable to solve your problems as well as more
  100.   suggestion on maintenance.
  101.  
  102.   Due to an enormous amount of spam I have been forced to mangle all e-
  103.   mail addresses herein in order to fool the e-mail harvesters that scan
  104.   through the net for victims to be put on the lists. Feedbeck tells me
  105.   some damage has already happened, this is very unfortunate.  Mangiling
  106.   is done by replacing the @ character with  (at)
  107.  
  108.   A number of pointers to relevant mailing lists are also added.
  109.  
  110.   Since the 0.14 version was released there have been too many changes
  111.   to list here. I have received much input and a substantial patch from
  112.   kris (at) koentopp.de that adds many new details.  The document has
  113.   grown a lot, actually beyond expectations.
  114.  
  115.   I have also upgraded my system to Debian 1.2.6 and have replaced the
  116.   old Slackware values with the Debian values for disk space
  117.   requirements for the various directory. I will use Debian as a base
  118.   for discussions and examples here, though the HOWTO is equally
  119.   applicable to other distributions, even other operating systems. At
  120.   the time of writing this Debian 1.3 is out in beta and will soon be
  121.   used as the test bench for further versions of this document.
  122.   More news: there has been a fair bit of interest in new kinds of file
  123.   systems in the comp.os.linux newsgroups, in particular logging,
  124.   journaling and inherited file systems. Watch out for updates. Projects
  125.   on volume management is also under way. The old defragmentation
  126.   program for ext2fs is being updated and there is continuing interests
  127.   for compression.
  128.  
  129.   The latest version number of this document can be gleaned from my plan
  130.   entry if you finger <finger:sgjoen@nox.nyx.net> my Nyx account.
  131.  
  132.   Also, the latest version will be available on my web space on nyx: The
  133.   Multi Disk System Tuning mini-HOWTO Homepage
  134.   <http://www.nyx.net/~sgjoen/disk.html>.
  135.  
  136.   A text-only version as well as the SGML source can also be downloaded
  137.   there.  A nicely formatted postscript version is also available now.
  138.   In order to save disk space and bandwidth it has been compressed using
  139.   gzip.
  140.  
  141.   Also planned is a series of URLs to helpful software referred to in
  142.   this document. A mirror in Europe will be announced soon.
  143.  
  144.   I have very recently changed jobs, address etc so there will be a few
  145.   delays in updates before I get the time for a more systematic updates.
  146.  
  147.   From version 0.15 onward this document is primarily handles as an SGML
  148.   document which means future printouts should look nicer than the old
  149.   text based version. This also means that it has more or less grown
  150.   into a full HOWTO. With respect to size it must be admitted it is a
  151.   long time there was anything "mini" about it.
  152.  
  153.   1.4.  Credits
  154.  
  155.   In this version I have the pleasure of acknowledging even more people
  156.   who have contributed in one way or another:
  157.  
  158.        ronnej (at ) ucs.orst.edu
  159.        cm (at) kukuruz.ping.at
  160.        armbru (at) pond.sub.org
  161.        R.P.Blake (at) open.ac.uk
  162.        neuffer (at) goofy.zdv.Uni-Mainz.de
  163.        sjmudd (at) redestb.es
  164.        nat (at) nataa.fr.eu.org
  165.        sundbyk (at) horten.geco-prakla.slb.com
  166.        gjoen (at) sn.no
  167.        mike (at) i-Connect.Net
  168.        roth (at) uiuc.edu
  169.        phall (at) ilap.com
  170.        szaka (at) mirror.cc.u-szeged.hu
  171.        CMckeon (at) swcp.com
  172.        kris (at) koentopp.de
  173.        edick (at) idcomm.com
  174.        pot (at) fly.cnuce.cnr.it
  175.  
  176.   Special thanks go to nakano (at) apm.seikei.ac.jp for doing the
  177.   Japanese translation <http://jf.linux.or.jp/JF/JF-ftp/other-
  178.   formats/Disk-HOWTO/html/Disk-HOWTO.html>, general contributions as
  179.   well as contributing an example of a computer in an academic setting,
  180.   which is included at the end of this document.
  181.  
  182.   Not many still, so please read through this document, make a
  183.   contribution and join the elite. If I have forgotten anyone, please
  184.   let me know.
  185.  
  186.   New in this version is an appendix with a few tables you can fill in
  187.   for your system in order to simplify the design process.
  188.  
  189.   Any comments or suggestions can be mailed to my mail address on nyx:
  190.   sgjoen@nyx.net.
  191.  
  192.   So let's cut to the chase where swap and /tmp are racing along hard
  193.   drive...
  194.  
  195.   2.  Structure
  196.  
  197.   As this type of document is supposed to be as much for learning as a
  198.   technical reference document I have rearranged the structure to this
  199.   end. For the designer of a system it is more useful to have the
  200.   information presented in terms of the goals of this exercise than from
  201.   the point of view of the logical layer structure of the devices
  202.   themselves. Nevertheless this document would not be complete without
  203.   such a layer structure the computer field is so full of, so I will
  204.   include it here as an introduction to how it works.
  205.  
  206.   It is a long time since the mini in mini-HOWTO could be defended as
  207.   proper but I am convinced that this document is as long as it needs to
  208.   be in order to make the right design decisions, and not longer.
  209.  
  210.   2.1.  Logical structure
  211.  
  212.   This is based on how each layer access each other, traditionally with
  213.   the application on top and the physical layer on the bottom.  It is
  214.   quite useful to show the interrelationship between each of the layers
  215.   used in controlling drives.
  216.  
  217.                ___________________________________________________________
  218.                |__     File structure          ( /usr /tmp etc)        __|
  219.                |__     File system             (ext2fs, vfat etc)      __|
  220.                |__     Volume management       (AFS)                   __|
  221.                |__     RAID, concatenation     (md)                    __|
  222.                |__     Device driver           (SCSI, IDE etc)         __|
  223.                |__     Controller              (chip, card)            __|
  224.                |__     Connection              (cable, network)        __|
  225.                |__     Drive                   (magnetic, optical etc) __|
  226.                -----------------------------------------------------------
  227.  
  228.   In the above diagram both volume management and RAID and concatenation
  229.   are optional layers. The 3 lower layers are in hardware.  All parts
  230.   are discussed at length later on in this document.
  231.  
  232.   2.2.  Document structure
  233.  
  234.   Most users start out with a given set of hardware and some plans on
  235.   what they wish to achieve and how big the system should be. This is
  236.   the point of view I will adopt in this document in presenting the
  237.   material, starting out with hardware, continuing with design
  238.   constraints before detailing the design strategy that I have found to
  239.   work well.  I have used this both for my own personal computer at
  240.   home, a multi purpose server at work and found it worked quite well.
  241.   In addition my Japanese co-worker in this project have applied the
  242.   same strategy on a server in an academic setting with similar success.
  243.  
  244.   Finally at the end I have detailed some configuration tables for use
  245.   in your own design. If you have any comments regarding this or notes
  246.   from your own design work I would like to hear from you so this
  247.   document can be upgraded.
  248.  
  249.   3.  Drive technologies
  250.  
  251.   A far more complete discussion on drive technologies for IBM PCs can
  252.   be found at the home page of The Enhanced IDE/Fast-ATA FAQ
  253.   <http://thef-nym.sci.kun.nl/~pieterh/storage.html> which is also
  254.   regularly posted on Usenet News.  Here I will just present what is
  255.   needed to get an understanding of the technology and get you started
  256.   on your setup.
  257.  
  258.   3.1.  Drives
  259.  
  260.   This is the physical device where your data lives and although the
  261.   operating system makes the various types seem rather similar they can
  262.   in actual fact be very different. An understanding of how it works can
  263.   be very useful in your design work. Floppy drives fall outside the
  264.   scope of this document, though should there be a big demand I could
  265.   perhaps be persuaded to add a little here.
  266.  
  267.   3.2.  Geometry
  268.  
  269.   Physically disk drives consists of one or more platters containing
  270.   data that is read in and out using sensors mounted on movable heads
  271.   that are fixed with respects to themselves. Data transfers therefore
  272.   happens across all surfaces simultaneously which defines a cylinder of
  273.   tracks. The drive is also divided into sectors containing a number of
  274.   data fields.
  275.  
  276.   Drives are therefore often specified in terms of its geometry: the
  277.   number of Cylinders, Heads and Sectors (CHS).
  278.  
  279.   For various reasons there is now a number of translations between
  280.  
  281.   ╖  the physical CHS of the drive itself
  282.  
  283.   ╖  the logical CHS the drive reports to the BIOS or OS
  284.  
  285.   ╖  the logical CHS used by the OS
  286.  
  287.   Basically it is a mess and a source of much confusion. For more
  288.   information you are strongly recommended to read the Large Disk mini-
  289.   HOWTO
  290.  
  291.   3.3.  Media
  292.  
  293.   The media technology determines important parameters such as
  294.   read/write rates, seek times, storage size as well as if it is
  295.   read/write or read only.
  296.  
  297.   3.3.1.  Magnetic Drives
  298.  
  299.   This is the typical read-write mass storage medium, and as everything
  300.   else in the computer world, comes in many flavours with different
  301.   properties. Usually this is the fastest technology and offers
  302.   read/write capability. The platter rotates with a constant angular
  303.   velocity (CAV) with a variable physical sector density for more
  304.   efficient magnetic media area utilisation.  In other words, the number
  305.   of bits per unit length is kept roughly constant by increasing the
  306.   number of logical sectors for the outer tracks.
  307.  
  308.   Typical values for rotational speeds are 4500 and 5400 rpm, though
  309.   7200 is also used. Very recently also 10000 rpm has entered the mass
  310.   market.  Seek times are around 10ms, transfer rates quite variable
  311.   from one type to another but typically 4-40 MB/s.  With the extreme
  312.   high performance drives you should remember that performance costs
  313.   more electric power which is dissipated as heat, see the point on
  314.   ``Power and Heating''.
  315.  
  316.   Note that there are several kinds of transfers going on here, and that
  317.   these are quoted in different units. First of all there is the
  318.   platter-to-drive cache transfer, usually quoted in Mbits/s. Typical
  319.   values here is about 50-250 Mbits/s. The second stage is from the
  320.   built in drive cache to the adapter, and this is typically quoted in
  321.   MB/s, and typical quoted values here is 3-40 MB/s. Note, however, that
  322.   this assumed data is already in the cache and hence for maximum
  323.   readout speed from the drive the effective transfer rate will decrease
  324.   dramatically.
  325.  
  326.   3.3.2.  Optical drives
  327.  
  328.   Optical read/write drives exist but are slow and not so common. They
  329.   were used in the NeXT machine but the low speed was a source for much
  330.   of the complaints. The low speed is mainly due to the thermal nature
  331.   of the phase change that represents the data storage. Even when using
  332.   relatively powerful lasers to induce the phase changes the effects are
  333.   still slower than the magnetic effect used in magnetic drives.
  334.  
  335.   Today many people use CD-ROM drives which, as the name suggests, is
  336.   read-only. Storage is about 650MB, transfer speeds are variable,
  337.   depending on the drive but can exceed 1.5MB/s. Data is stored on a
  338.   spiraling single track so it is not useful to talk about geometry for
  339.   this. Data density is constant so the drive uses constant linear
  340.   velocity (CLV). Seek is also slower, about 100ms, partially due to the
  341.   spiraling track. Recent, high speed drives, use a mix of CLV and CAV
  342.   in order to maximize performance. This also reduces access time caused
  343.   by the need to reach correct rotational speed for readout.
  344.  
  345.   A new type (DVD) is on the horizon, offering up to about 18GB on a
  346.   single disk.
  347.  
  348.   3.3.3.  Solid State Drives
  349.  
  350.   This is a relatively recent addition to the available technology and
  351.   has been made popular especially in portable computers as well as in
  352.   embedded systems. Containing no movable parts they are very fast both
  353.   in terms of access and transfer rates. The most popular type is flash
  354.   RAM, but also other types of RAM is used. A few years ago many had
  355.   great hopes for magnetic bubble memories but it turned out to be
  356.   relatively expensive and is not that common.
  357.  
  358.   In general the use of RAM disks are regarded as a bad idea as it is
  359.   normally more sensible to add more RAM to the motherboard and let the
  360.   operating system divide the memory pool into buffers, cache, program
  361.   and data areas. Only in very special cases, such as real time systems
  362.   with short time margins, can RAM disks be a sensible solution.
  363.  
  364.   Flash RAM is today available in several 10's of megabytes in storage
  365.   and one might be tempted to use it for fast, temporary storage in a
  366.   computer. There is however a huge snag with this: flash RAM has a
  367.   finite life time in terms of the number of times you can rewrite data,
  368.   so putting swap, /tmp or /var/tmp on such a device will certainly
  369.   shorten its lifetime dramatically.  Instead, using flash RAM for
  370.   directories that are read often but rarely written to, will be a big
  371.   performance win.
  372.  
  373.   In order to get the optimum life time out of flash RAM you will need
  374.   to use special drivers that will use the RAM evenly and minimize the
  375.   number of block erases.
  376.  
  377.   This example illustrates the advantages of splitting up your directory
  378.   structure over several devices.
  379.  
  380.   Solid state drives have no real cylinder/head/sector addressing but
  381.   for compatibility reasons this is simulated by the driver to give a
  382.   uniform interface to the operating system.
  383.  
  384.   3.4.  Interfaces
  385.  
  386.   There is a plethora of interfaces to chose from widely ranging in
  387.   price and performance. Most motherboards today include IDE interface
  388.   or better, Intel supports it through the Triton PCI chip set which is
  389.   very popular these days. Many motherboards also include a SCSI
  390.   interface chip made by NCR and that is connected directly to the PCI
  391.   bus.  Check what you have and what BIOS support you have with it.
  392.  
  393.   3.4.1.  MFM and RLL
  394.  
  395.   Once upon a time this was the established technology, a time when 20MB
  396.   was awesome, which compared to todays sizes makes you think that
  397.   dinosaurs roamed the Earth with these drives. Like the dinosaurs these
  398.   are outdated and are slow and unreliable compared to what we have
  399.   today. Linux does support this but you are well advised to think twice
  400.   about what you would put on this. One might argue that an emergency
  401.   partition with a suitable vintage of DOS might be fitting.
  402.  
  403.   3.4.2.  ESDI
  404.  
  405.   Actually, ESDI was an adaptation of the very widely used SMD interface
  406.   used on "big" computers to the cable set used with the ST506
  407.   interface, which was more convenient to package than the 60-pin +
  408.   26-pin connector pair used with SMD.  The ST506 was a "dumb" interface
  409.   which relied entirely on the controller and host computer to do
  410.   everything from computing head/cylinder/sector locations and keeping
  411.   track of the head location, etc. ST506 required the controller to
  412.   extract clock from the recovered data, and control the physical
  413.   location of detailed track features on the medium, bit by bit. It had
  414.   about a 10-year life if you include the use of MFM, RLL, and ERLL/ARLL
  415.   modulation schemes. ESDI, on the other hand, had intelligence, often
  416.   using three or four separate microprocessors on a single drive, and
  417.   high-level commands to format a track, transfer data, perform seeks,
  418.   and so on. Clock recovery from the data stream was accomplished at the
  419.   drive, which drove the clock line and presented its data in NRZ,
  420.   though error correction was still the task of the controller.  ESDI
  421.   allowed the use of variable bit density recording, or, for that
  422.   matter, any other modulation technique, since it was locally generated
  423.   and resolved at the drive. Though many of the techniques used in ESDI
  424.   were later incorporated in IDE, it was the increased popularity of
  425.   SCSI which led to the demise of ESDI in computers. ESDI had a life of
  426.   about 10 years, though mostly in servers and otherwise "big" systems
  427.   rather than PC's.
  428.  
  429.   3.4.3.  IDE and ATA
  430.  
  431.   Progress made the drive electronics migrate from the ISA slot card
  432.   over to the drive itself and Integrated Drive Electronics was borne.
  433.   It was simple, cheap and reasonably fast so the BIOS designers
  434.   provided the kind of snag that the computer industry is so full of. A
  435.   combination of an IDE limitation of 16 heads together with the BIOS
  436.   limitation of 1024 cylinders gave us the infamous 504MB limit.
  437.   Following the computer industry traditions again, the snag was patched
  438.   with a kludge and we got all sorts of translation schemes and BIOS
  439.   bodges. This means that you need to read the installation
  440.   documentation very carefully and check up on what BIOS you have and
  441.   what date it has as the BIOS has to tell Linux what size drive you
  442.   have. Fortunately with Linux you can also tell the kernel directly
  443.   what size drive you have with the drive parameters, check the
  444.   documentation for LILO and Loadlin, thoroughly. Note also that IDE is
  445.   equivalent to ATA, AT Attachment.  IDE uses CPU-intensive Programmed
  446.   Input/Output (PIO) to transfer data to and from the drives and has no
  447.   capability for the more efficient Direct Memory Access (DMA)
  448.   technology. Highest transfer rate is 8.3MB/s.
  449.  
  450.   3.4.4.  EIDE, Fast-ATA and ATA-2
  451.  
  452.   These 3 terms are roughly equivalent, fast-ATA is ATA-2 but EIDE
  453.   additionally includes ATAPI. ATA-2 is what most use these days which
  454.   is faster and with DMA. Highest transfer rate is increased to 16.6
  455.   MB/s.
  456.  
  457.   3.4.5.  Ultra-ATA
  458.  
  459.   A new, faster DMA mode that is approximately twice the speed of EIDE
  460.   PIO-Mode 4 (33 MB/s). Disks with and without Ultra-ATA can be mixed on
  461.   the same cable without speed penalty for the faster adapters. The
  462.   Ultra-ATA interface is electrically identical with the normal Fast-ATA
  463.   interface, including the maximum cable length.
  464.  
  465.   3.4.6.  ATAPI
  466.  
  467.   The ATA Packet Interface was designed to support CD-ROM drives using
  468.   the IDE port and like IDE it is cheap and simple.
  469.  
  470.   3.4.7.  SCSI
  471.  
  472.   The Small Computer System Interface is a multi purpose interface that
  473.   can be used to connect to everything from drives, disk arrays,
  474.   printers, scanners and more. The name is a bit of a misnomer as it has
  475.   traditionally been used by the higher end of the market as well as in
  476.   work stations since it is well suited for multi tasking environments.
  477.  
  478.   The standard interface is 8 bits wide and can address 8 devices.
  479.   There is a wide version with 16 bit that is twice as fast on the same
  480.   clock and can address 16 devices. The host adapter always counts as a
  481.   device and is usually number 7.  It is also possible to have 32 bit
  482.   wide busses but this usually requires a double set of cables to carry
  483.   all the lines.
  484.  
  485.   The old standard was 5MB/s and the newer fast-SCSI increased this to
  486.   10MB/s. Recently ultra-SCSI, also known as Fast-20, arrived with 20
  487.   MB/s transfer rates for an 8 bit wide bus.
  488.  
  489.   The higher performance comes at a cost that is usually higher than for
  490.   (E)IDE. The importance of correct termination and good quality cables
  491.   cannot be overemphasized. SCSI drives also often tend to be of a
  492.   higher quality than IDE drives. Also adding SCSI devices tend to be
  493.   easier than adding more IDE drives: Often it is only a matter of
  494.   plugging or unplugging the device; some people do this without
  495.   powering down the system. This feature is most convenient when you
  496.   have multiple systems and you can just take the devices from one
  497.   system to the other should one of them fail for some reason.
  498.  
  499.   There is a number of useful documents you should read if you use SCSI,
  500.   the SCSI HOWTO as well as the SCSI FAQ posted on Usenet News.
  501.  
  502.   SCSI also has the advantage you can connect it easily to tape drives
  503.   for backing up your data, as well as some printers and scanners. It is
  504.   even possible to use it as a very fast network between computers while
  505.   simultaneously share SCSI devices on the same bus. Work is under way
  506.   but due to problems with ensuring cache coherency between the
  507.   different computers connected, this is a non trivial task.
  508.  
  509.   3.5.  Cabling
  510.  
  511.   I do not intend to make too many comments on hardware but I feel I
  512.   should make a little note on cabling. This might seem like a
  513.   remarkably low technological piece of equipment, yet sadly it is the
  514.   source of many frustrating problems. At todays high speeds one should
  515.   think of the cable more of a an RF device with its inherent demands on
  516.   impedance matching. If you do not take your precautions you will get a
  517.   much reduced reliability or total failure. Some SCSI host adapters are
  518.   more sensitive to this than others.
  519.  
  520.   Shielded cables are of course better than unshielded but the price is
  521.   much higher. With a little care you can get good performance from a
  522.   cheap unshielded cable.
  523.  
  524.   ╖  For Fast-ATA and Ultra-ATA, the maximum cable length is specified
  525.      as 45cm (18"). The data lines of both IDE channels are connected on
  526.      many boards, though, so they count as one cable. In any case EIDE
  527.      cables should be as short as possible. If there are mysterious
  528.      crashes or spontaneous changes of data, it is well worth
  529.      investigating your cabling.  Try a lower PIO mode or disconnect the
  530.      second channel and see if the problem still occurs.
  531.  
  532.   ╖  Use as short cable as possible, but do not forget the 30cm minimum
  533.      separation for ultra SCSI.
  534.  
  535.   ╖  Avoid long stubs between the cable and the drive, connect the plug
  536.      on the cable directly to the drive without an extension.
  537.  
  538.   ╖  Use correct termination for SCSI devices and at the correct
  539.      position: the end of the SCSI chain.
  540.  
  541.   ╖  Do not mix shielded or unshielded cabling, do not wrap cables
  542.      around metal, try to avoid proximity to metal parts along parts of
  543.      the cabling. Any such discontinuities can cause impedance
  544.      mismatching which in turn can cause reflection of signals which
  545.      increases noise on the cable.  This problems gets even more severe
  546.      in the case of multi channel controllers.  Recently someone
  547.      suggested wrapping bubble plastic around the cables in order to
  548.      avoid too close proximity to metal, a real problem inside crowded
  549.      cabinets.
  550.  
  551.   3.6.  Host Adapters
  552.  
  553.   This is the other end of the interface from the drive, the part that
  554.   is connected to a computer bus. The speed of the computer bus and that
  555.   of the drives should be roughly similar, otherwise you have a
  556.   bottleneck in your system. Connecting a RAID 0 disk-farm to a ISA card
  557.   is pointless. These days most computers come with 32 bit PCI bus
  558.   capable of 132MB/s transfers which should not represent a bottleneck
  559.   for most people in the near future.
  560.  
  561.   As the drive electronic migrated to the drives the remaining part that
  562.   became the (E)IDE interface is so small it can easily fit into the PCI
  563.   chip set. The SCSI host adapter is more complex and often includes a
  564.   small CPU of its own and is therefore more expensive and not
  565.   integrated into the PCI chip sets available today. Technological
  566.   evolution might change this.
  567.  
  568.   Some host adapters come with separate caching and intelligence but as
  569.   this is basically second guessing the operating system the gains are
  570.   heavily dependent on which operating system is used. Some of the more
  571.   primitive ones, that shall remain nameless, experience great gains.
  572.   Linux, on the other hand, have so much smarts of its own that the
  573.   gains are much smaller.
  574.  
  575.   Mike Neuffer, who did the drivers for the DPT controllers, states that
  576.   the DPT controllers are intelligent enough that given enough cache
  577.   memory it will give you a big push in performance and suggests that
  578.   people who have experienced little gains with smart controllers just
  579.   have not used a sufficiently intelligent caching controller.
  580.  
  581.   3.7.  Multi Channel Systems
  582.  
  583.   In order to increase throughput it is necessary to identify the most
  584.   significant bottlenecks and then eliminate them. In some systems, in
  585.   particular where there are a great number of drives connected, it is
  586.   advantageous to use several controllers working in parallel, both for
  587.   SCSI host adapters as well as IDE controllers which usually have 2
  588.   channels built in. Linux supports this.
  589.  
  590.   Some RAID controllers feature 2 or 3 channels and it pays to spread
  591.   the disk load across all channels. In other words, if you have two
  592.   SCSI drives you want to RAID and a two channel controller, you should
  593.   put each drive on separate channels.
  594.  
  595.   3.8.  Multi Board Systems
  596.  
  597.   In addition to having both a SCSI and an IDE in the same machine it is
  598.   also possible to have more than one SCSI controller. Check the SCSI-
  599.   HOWTO on what controllers you can combine. Also you will most likely
  600.   have to tell the kernel it should probe for more than just a single
  601.   SCSI or a single IDE controller. This is done using kernel parameters
  602.   when booting, for instance using LILO.  Check the HOWTOs for SCSI and
  603.   LILO for how to do this.
  604.  
  605.   3.9.  Speed Comparison
  606.  
  607.   The following tables are given just to indicate what speeds are
  608.   possible but remember that these are the theoretical maximum speeds.
  609.   All transfer rates are in MB per second and bus widths are measured in
  610.   bits.
  611.  
  612.   3.9.1.  Controllers
  613.  
  614.        IDE             :       8.3 - 16.7
  615.        Ultra-ATA       :       33
  616.  
  617.        SCSI            :
  618.                                Bus width (bits)
  619.  
  620.        Bus Speed (MHz)         |        8      16      32
  621.        --------------------------------------------------
  622.         5                      |        5      10      20
  623.        10  (fast)              |       10      20      40
  624.        20  (fast-20 / ultra)   |       20      40      80
  625.        40  (fast-40 / ultra-2) |       40      80      --
  626.        --------------------------------------------------
  627.  
  628.   3.9.2.  Bus types
  629.  
  630.        ISA             :       8-12
  631.        EISA            :       33
  632.        VESA            :       40    (Sometimes tuned to 50)
  633.  
  634.        PCI
  635.                                Bus width (bits)
  636.  
  637.        Bus Speed (MHz)         |       32      64
  638.        --------------------------------------------------
  639.        33                      |       132     264
  640.        66                      |       264     528
  641.        --------------------------------------------------
  642.  
  643.   3.10.  Benchmarking
  644.  
  645.   This is a very, very difficult topic and I will only make a few
  646.   cautious comments about this minefield. First of all, it is more
  647.   difficult to make comparable benchmarks that have any actual meaning.
  648.   This, however, does not stop people from trying...
  649.  
  650.   Instead one can use benchmarking to diagnose your own system, to check
  651.   it is going as fast as it should, that is, not slowing down.  Also you
  652.   would expect a significant increase when switching from a simple file
  653.   system to RAID, so a lack of performance gain will tell you something
  654.   is wrong.
  655.   When you try to benchmark you should not hack up your own, instead
  656.   look up iozone and bonnie and read the documentation very carefully.
  657.   More information about this is coming soon.
  658.  
  659.   3.11.  Comparisons
  660.  
  661.   SCSI offers more performance than EIDE but at a price.  Termination is
  662.   more complex but expansion not too difficult.  Having more than 4 (or
  663.   in some cases 2) IDE drives can be complicated, with wide SCSI you can
  664.   have up to 15 per adapter.  Some SCSI host adapters have several
  665.   channels thereby multiplying the number of possible drives even
  666.   further.
  667.  
  668.   RLL and MFM is in general too old, slow and unreliable to be of much
  669.   use.
  670.  
  671.   3.12.  Future Development
  672.  
  673.   SCSI-3 is under way and will hopefully be released soon. Faster
  674.   devices are already being announced, most recently an 80MB/s monster
  675.   specification has been proposed.  This is based around the ultra-2
  676.   standard (which used a 40MHz clock) combined with a 16 bit cable.
  677.  
  678.   Some manufacturers already announce SCSI-3 devices but this is
  679.   currently rather premature as the standard is not yet firm. As the
  680.   transfer speeds increase the saturation point of the PCI bus is
  681.   getting closer. Currently the 64 bit version has a limit of 264MB/s.
  682.   The PCI transfer rate will in the future be increased from the current
  683.   33MHz to 66MHz, thereby increasing the limit to 528MB/s.
  684.  
  685.   Another trend is for larger and larger drives. I hear it is possible
  686.   to get 55GB on a single drive though this is rather expensive.
  687.   Currently the optimum storage for your money is about 5GB but also
  688.   this is continuously increasing. The introduction of DVD will in the
  689.   near future have a big impact, with nearly 20GB on a single disk you
  690.   can have a complete copy of even major FTP sites from around the
  691.   world. The only thing we can be reasonably sure about the future is
  692.   that even if it won't get any better, it will definitely be bigger.
  693.  
  694.   Addendum: soon after I first wrote this I read that the maximum useful
  695.   speed for a CD-ROM was 20x as mechanical stability would be too great
  696.   a problem at these speeds. About one month after that again the first
  697.   commercial 24x CD-ROMs were available...
  698.  
  699.   3.13.  Recommendations
  700.  
  701.   My personal view is that EIDE is the best way to start out on your
  702.   system, especially if you intend to use DOS as well on your machine.
  703.   If you plan to expand your system over many years or use it as a
  704.   server I would strongly recommend you get SCSI drives. Currently wide
  705.   SCSI is a little more expensive. You are generally more likely to get
  706.   more for your money with standard width SCSI. There is also
  707.   differential versions of the SCSI bus which increases maximum length
  708.   of the cable. The price increase is even more substantial and cannot
  709.   therefore be recommended for normal users.
  710.  
  711.   In addition to disk drives you can also connect some types of scanners
  712.   and printers and even networks to a SCSI bus.
  713.  
  714.   Also keep in mind that as you expand your system you will draw ever
  715.   more power, so make sure your power supply is rated for the job and
  716.   that you have sufficient cooling. Many SCSI drives offer the option of
  717.   sequential spin-up which is a good idea for large systems.  See also
  718.   the point on ``Power and Heating''.
  719.  
  720.   4.  Considerations
  721.  
  722.   The starting point in this will be to consider where you are and what
  723.   you want to do. The typical home system starts out with existing
  724.   hardware and the newly converted Linux user will want to get the most
  725.   out of existing hardware. Someone setting up a new system for a
  726.   specific purpose (such as an Internet provider) will instead have to
  727.   consider what the goal is and buy accordingly. Being ambitious I will
  728.   try to cover the entire range.
  729.  
  730.   Various purposes will also have different requirements regarding file
  731.   system placement on the drives, a large multiuser machine would
  732.   probably be best off with the /home directory on a separate disk, just
  733.   to give an example.
  734.  
  735.   In general, for performance it is advantageous to split most things
  736.   over as many disks as possible but there is a limited number of
  737.   devices that can live on a SCSI bus and cost is naturally also a
  738.   factor. Equally important, file system maintenance becomes more
  739.   complicated as the number of partitions and physical drives increases.
  740.  
  741.   4.1.  File system features
  742.  
  743.   The various parts of FSSTND have different requirements regarding
  744.   speed, reliability and size, for instance losing root is a pain but
  745.   can easily be recovered. Losing /var/spool/mail is a rather different
  746.   issue. Here is a quick summary of some essential parts and their
  747.   properties and requirements. Note that this is just a guide, there can
  748.   be binaries in etc and lib directories, libraries in bin directories
  749.   and so on.
  750.  
  751.   4.1.1.  Swap
  752.  
  753.      Speed
  754.         Maximum! Though if you rely too much on swap you should consider
  755.         buying some more RAM. Note, however, that on many PC
  756.         motherboards the cache will not work on RAM above 128MB.
  757.  
  758.      Size
  759.         Similar as for RAM. Quick and dirty algorithm: just as for tea:
  760.         16MB for the machine and 2MB for each user. Smallest kernel run
  761.         in 1MB but is tight, use 4MB for general work and light
  762.         applications, 8MB for X11 or GCC or 16MB to be comfortable.
  763.         (The author is known to brew a rather powerful cuppa tea...)
  764.  
  765.         Some suggest that swap space should be 1-2 times the size of the
  766.         RAM, pointing out that the locality of the programs determines
  767.         how effective your added swap space is. Note that using the same
  768.         algorithm as for 4BSD is slightly incorrect as Linux does not
  769.         allocate space for pages in core.
  770.  
  771.         Also remember to take into account the type of programs you use.
  772.         Some programs that have large working sets, such as finite
  773.         element modeling (FEM) have huge data structures loaded in RAM
  774.         rather than working explicitly on disk files. Data and computing
  775.         intensive programs like this will cause excessive swapping if
  776.         you have less RAM than the requirements.
  777.  
  778.         Other types of programs can lock their pages into RAM. This can
  779.         be for security reasons, preventing copies of data reaching a
  780.         swap device or for performance reasons such as in a real time
  781.         module. Either way, locking pages reduces the remaining amount
  782.         of swappable memory and can cause the system to swap earlier
  783.         then otherwise expected.
  784.  
  785.         In man 8 mkswap it is explained that each swap partition can be
  786.         a maximum of just under 128 MB in size.
  787.  
  788.      Reliability
  789.         Medium. When it fails you know it pretty quickly and failure
  790.         will cost you some lost work. You save often, don't you?
  791.  
  792.      Note 1
  793.         Linux offers the possibility of interleaved swapping across
  794.         multiple devices, a feature that can gain you much. Check out
  795.         "man 8 swapon" for more details. However, software raiding swap
  796.         across multiple devices adds more overheads than you gain.
  797.  
  798.         Thus the /etc/fstab file might look like this:
  799.  
  800.           /dev/sda1       swap            swap    pri=1           0       0
  801.           /dev/sdc1       swap            swap    pri=1           0       0
  802.  
  803.      Remember that the fstab file is very sensitive to the formatting
  804.      used, read the man page carefully and do not just cut and paste the
  805.      lines above.
  806.  
  807.      Note 2
  808.         Some people use a RAM disk for swapping or some other file
  809.         systems. However, unless you have some very unusual requirements
  810.         or setups you are unlikely to gain much from this as this cuts
  811.         into the memory available for caching and buffering.
  812.  
  813.   4.1.2.  Temporary storage (/tmp and /var/tmp)
  814.  
  815.      Speed
  816.         Very high. On a separate disk/partition this will reduce
  817.         fragmentation generally, though ext2fs handles fragmentation
  818.         rather well.
  819.  
  820.      Size
  821.         Hard to tell, small systems are easy to run with just a few MB
  822.         but these are notorious hiding places for stashing files away
  823.         from prying eyes and quota enforcements and can grow without
  824.         control on larger machines. Suggested: small home machine: 8MB,
  825.         large home machine: 32MB, small server: 128MB, and large
  826.         machines up to 500MB (The machine used by the author at work has
  827.         1100 users and a 300MB /tmp directory). Keep an eye on these
  828.         directories, not only for hidden files but also for old files.
  829.         Also be prepared that these partitions might be the first reason
  830.         you might have to resize your partitions.
  831.  
  832.      Reliability
  833.         Low. Often programs will warn or fail gracefully when these
  834.         areas fail or are filled up. Random file errors will of course
  835.         be more serious, no matter what file area this is.
  836.  
  837.      Files
  838.         Mostly short files but there can be a huge number of them.
  839.         Normally programs delete their old tmp files but if somehow an
  840.         interruption occurs they could survive. Many distributions have
  841.         a policy regarding cleaning out tmp files at boot time, you
  842.         might want to check out what your setup is.
  843.  
  844.      Note
  845.         In FSSTND there is a note about putting /tmp on RAM disk. This,
  846.         however, is not recommended for the same reasons as stated for
  847.         swap. Also, as noted earlier, do not use flash RAM drives for
  848.         these directories. One should also keep in mind that some
  849.         systems are set to automatically clean tmp areas on rebooting.
  850.  
  851.   (* That was 50 lines, I am home and dry! *)
  852.  
  853.   4.1.3.  Spool areas (/var/spool/news and /var/spool/mail)
  854.  
  855.      Speed
  856.         High, especially on large news servers. News transfer and
  857.         expiring are disk intensive and will benefit from fast drives.
  858.         Print spools: low. Consider RAID0 for news.
  859.  
  860.      Size
  861.         For news/mail servers: whatever you can afford. For single user
  862.         systems a few MB will be sufficient if you read continuously.
  863.         Joining a list server and taking a holiday is, on the other
  864.         hand, not a good idea.  (Again the machine I use at work has
  865.         100MB reserved for the entire /var/spool)
  866.  
  867.      Reliability
  868.         Mail: very high, news: medium, print spool: low. If your mail is
  869.         very important (isn't it always?) consider RAID for reliability.
  870.  
  871.      Files
  872.         Usually a huge number of files that are around a few KB in size.
  873.         Files in the print spool can on the other hand be few but quite
  874.         sizable.
  875.  
  876.      Note
  877.         Some of the news documentation suggests putting all the
  878.         .overview files on a drive separate from the news files, check
  879.         out all news FAQs for more information.
  880.  
  881.   4.1.4.  Home directories (/home)
  882.  
  883.      Speed
  884.         Medium. Although many programs use /tmp for temporary storage,
  885.         others such as some news readers frequently update files in the
  886.         home directory which can be noticeable on large multiuser
  887.         systems. For small systems this is not a critical issue.
  888.  
  889.      Size
  890.         Tricky! On some systems people pay for storage so this is
  891.         usually then a question of finance. Large systems such as
  892.         nyx.net <http://www.nyx.net/> (which is a free Internet service
  893.         with mail, news and WWW services) run successfully with a
  894.         suggested limit of 100K per user and 300K as enforced maximum.
  895.         Commercial ISPs offer typically about 5MB in their standard
  896.         subscription packages.
  897.  
  898.         If however you are writing books or are doing design work the
  899.         requirements balloon quickly.
  900.  
  901.      Reliability
  902.         Variable. Losing /home on a single user machine is annoying but
  903.         when 2000 users call you to tell you their home directories are
  904.         gone it is more than just annoying. For some their livelihood
  905.         relies on what is here. You do regular backups of course?
  906.  
  907.      Files
  908.         Equally tricky. The minimum setup for a single user tends to be
  909.         a dozen files, 0.5 - 5 kB in size. Project related files can be
  910.         huge though.
  911.  
  912.      Note1
  913.         You might consider RAID for either speed or reliability. If you
  914.         want extremely high speed and reliability you might be looking
  915.         at other operating system and hardware platforms anyway.  (Fault
  916.         tolerance etc.)
  917.  
  918.      Note2
  919.         Web browsers often use a local cache to speed up browsing and
  920.         this cache can take up a substantial amount of space and cause
  921.         much disk activity. There are many ways of avoiding this kind of
  922.         performance hits, for more information see the sections on
  923.         ``Home Directories'' and ``WWW''.
  924.  
  925.      Note3
  926.         Users often tend to use up all available space on the /home
  927.         partition. The Linux Quota subsystem is capable of limiting the
  928.         number of blocks and the number of inode a single user ID can
  929.         allocate on a per-filesystem basis. See the Linux Quota mini-
  930.         HOWTO <http://sunsite.unc.edu/LDP/mini> by Albert M.C. Tam
  931.         <mailto:bertie (at) scn.org> for details on setup.
  932.  
  933.   4.1.5.  Main binaries ( /usr/bin and /usr/local/bin)
  934.  
  935.      Speed
  936.         Low. Often data is bigger than the programs which are demand
  937.         loaded anyway so this is not speed critical. Witness the
  938.         successes of live file systems on CD ROM.
  939.  
  940.      Size
  941.         The sky is the limit but 200MB should give you most of what you
  942.         want for a comprehensive system. A big system, for software
  943.         development or a multi purpose server should perhaps reserve
  944.         500MB both for installation and for growth.
  945.  
  946.      Reliability
  947.         Low. This is usually mounted under root where all the essentials
  948.         are collected. Nevertheless losing all the binaries is a pain...
  949.  
  950.      Files
  951.         Variable but usually of the order of 10 - 100 kB.
  952.  
  953.   4.1.6.  Libraries ( /usr/lib and /usr/local/lib)
  954.  
  955.      Speed
  956.         Medium. These are large chunks of data loaded often, ranging
  957.         from object files to fonts, all susceptible to bloating. Often
  958.         these are also loaded in their entirety and speed is of some use
  959.         here.
  960.  
  961.      Size
  962.         Variable. This is for instance where word processors store their
  963.         immense font files. The few that have given me feedback on this
  964.         report about 70MB in their various lib directories.  A rather
  965.         complete Debian 1.2 installation can take as much as 250MB which
  966.         can be taken as an realistic upper limit.  The following ones
  967.         are some of the largest disk space consumers: GCC, Emacs,
  968.         TeX/LaTeX, X11 and perl.
  969.  
  970.      Reliability
  971.         Low. See point ``Main binaries''.
  972.  
  973.      Files
  974.         Usually large with many of the order of 100 kB in size.
  975.  
  976.      Note
  977.         For historical reasons some programs keep executables in the lib
  978.         areas. One example is GCC which have some huge binaries in the
  979.         /usr/lib/gcc/lib hierarchy.
  980.  
  981.   4.1.7.  Root
  982.  
  983.      Speed
  984.         Quite low: only the bare minimum is here, much of which is only
  985.         run at startup time.
  986.  
  987.      Size
  988.         Relatively small. However it is a good idea to keep some
  989.         essential rescue files and utilities on the root partition and
  990.         some keep several kernel versions. Feedback suggests about 20MB
  991.         would be sufficient.
  992.  
  993.      Reliability
  994.         High. A failure here will possibly cause a fair bit of grief and
  995.         you might end up spending some time rescuing your boot
  996.         partition. With some practice you can of course do this in an
  997.         hour or so, but I would think if you have some practice doing
  998.         this you are also doing something wrong.
  999.  
  1000.         Naturally you do have a rescue disk? Of course this is updated
  1001.         since you did your initial installation? There are many ready
  1002.         made rescue disks as well as rescue disk creation tools you
  1003.         might find valuable.  Presumably investing some time in this
  1004.         saves you from becoming a root rescue expert.
  1005.  
  1006.      Note 1
  1007.         If you have plenty of drives you might consider putting a spare
  1008.         emergency boot partition on a separate physical drive. It will
  1009.         cost you a little bit of space but if your setup is huge the
  1010.         time saved, should something fail, will be well worth the extra
  1011.         space.
  1012.  
  1013.      Note 2
  1014.         For simplicity and also in case of emergencies it is not
  1015.         advisable to put the root partition on a RAID level 0 system.
  1016.         Also if you use RAID for your boot partition you have to
  1017.         remember to have the md option turned on for your emergency
  1018.         kernel.
  1019.  
  1020.   4.1.8.  DOS etc.
  1021.  
  1022.   At the danger of sounding heretical I have included this little
  1023.   section about something many reading this document have strong
  1024.   feelings about.  Unfortunately many hardware items come with setup and
  1025.   maintenance tools based around those systems, so here goes.
  1026.  
  1027.      Speed
  1028.         Very low. The systems in question are not famed for speed so
  1029.         there is little point in using prime quality drives.
  1030.         Multitasking or multi-threading are not available so the command
  1031.         queueing facility found in SCSI drives will not be taken
  1032.         advantage of. If you have an old IDE drive it should be good
  1033.         enough. The exception is to some degree Win95 and more notably
  1034.         NT which have multi-threading support which should theoretically
  1035.         be able to take advantage of the more advanced features offered
  1036.         by SCSI devices.
  1037.  
  1038.      Size
  1039.         The company behind these operating systems is not famed for
  1040.         writing tight code so you have to be prepared to spend a few
  1041.         tens of MB depending on what version you install of the OS or
  1042.         Windows. With an old version of DOS or Windows you might fit it
  1043.         all in on 50MB.
  1044.  
  1045.      Reliability
  1046.         Ha-ha. As the chain is no stronger than the weakest link you can
  1047.         use any old drive. Since the OS is more likely to scramble
  1048.         itself than the drive is likely to self destruct you will soon
  1049.         learn the importance of keeping backups here.
  1050.  
  1051.         Put another way: "Your mission, should you choose to accept it,
  1052.         is to keep this partition working. The warranty will self
  1053.         destruct in 10 seconds..."
  1054.  
  1055.         Recently I was asked to justify my claims here. First of all I
  1056.         am not calling DOS and Windows sorry excuses for operating
  1057.         systems. Secondly there are various legal issues to be taken
  1058.         into account. Saying there is a connection between the last two
  1059.         sentences are merely the ravings of the paranoid. Surely.
  1060.         Instead I shall offer the esteemed reader a few key words: DOS
  1061.         4.0, DOS 6.x and various drive compression tools that shall
  1062.         remain nameless.
  1063.  
  1064.   4.2.  Explanation of terms
  1065.  
  1066.   Naturally the faster the better but often the happy installer of Linux
  1067.   has several disks of varying speed and reliability so even though this
  1068.   document describes performance as 'fast' and 'slow' it is just a rough
  1069.   guide since no finer granularity is feasible. Even so there are a few
  1070.   details that should be kept in mind:
  1071.  
  1072.   4.2.1.  Speed
  1073.  
  1074.   This is really a rather woolly mix of several terms: CPU load,
  1075.   transfer setup overhead, disk seek time and transfer rate. It is in
  1076.   the very nature of tuning that there is no fixed optimum, and in most
  1077.   cases price is the dictating factor. CPU load is only significant for
  1078.   IDE systems where the CPU does the transfer itself but is generally
  1079.   low for SCSI, see SCSI documentation for actual numbers. Disk seek
  1080.   time is also small, usually in the millisecond range. This however is
  1081.   not a problem if you use command queueing on SCSI where you then
  1082.   overlap commands keeping the bus busy all the time. News spools are a
  1083.   special case consisting of a huge number of normally small files so in
  1084.   this case seek time can become more significant.
  1085.  
  1086.   There are two main parameters that are of interest here:
  1087.  
  1088.      Seek
  1089.         is usually specified in the average time take for the read/write
  1090.         head to seek from one track to another. This parameter is
  1091.         important when dealing with a large number of small files such
  1092.         as found in spool files.  There is also the extra seek delay
  1093.         before the desired sector rotates into position under the head.
  1094.         This delay is dependent on the angular velocity of the drive
  1095.         which is why this parameter quite often is quoted for a drive.
  1096.         Common values are 4500, 5400 and 7200 rpm (rotations per
  1097.         minute). Higher rpm reduces the seek time but at a substantial
  1098.         cost.  Also drives working at 7200 rpm have been known to be
  1099.         noisy and to generate a lot of heat, a factor that should be
  1100.         kept in mind if you are building a large array or "disk farm".
  1101.         Very recently drives working at 10000 rpm has entered the market
  1102.         and here the cooling requirements are even stricter and minimum
  1103.         figures for air flow are given.
  1104.  
  1105.      Transfer
  1106.         is usually specified in megabytes per second.  This parameter is
  1107.         important when handling large files that have to be transferred.
  1108.         Library files, dictionaries and image files are examples of
  1109.         this. Drives featuring a high rotation speed also normally have
  1110.         fast transfers as transfer speed is proportional to angular
  1111.         velocity for the same sector density.
  1112.  
  1113.   It is therefore important to read the specifications for the drives
  1114.   very carefully, and note that the maximum transfer speed quite often
  1115.   is quoted for transfers out of the on board cache (burst speed) and
  1116.   not directly from the platter (sustained speed).  See also section on
  1117.   ``Power and Heating''.
  1118.  
  1119.   4.2.2.  Reliability
  1120.  
  1121.   Naturally no-one would want low reliability disks but one might be
  1122.   better off regarding old disks as unreliable. Also for RAID purposes
  1123.   (See the relevant information) it is suggested to use a mixed set of
  1124.   disks so that simultaneous disk crashes become less likely.
  1125.  
  1126.   So far I have had only one report of total file system failure but
  1127.   here unstable hardware seemed to be the cause of the problems.
  1128.  
  1129.   4.2.3.  Files
  1130.  
  1131.   The average file size is important in order to decide the most
  1132.   suitable drive parameters. A large number of small files makes the
  1133.   average seek time important whereas for big files the transfer speed
  1134.   is more important.  The command queueing in SCSI devices is very handy
  1135.   for handling large numbers of small files, but for transfer EIDE is
  1136.   not too far behind SCSI and normally much cheaper than SCSI.
  1137.  
  1138.   4.3.  Technologies
  1139.  
  1140.   In order to decide how to get the most of your devices you need to
  1141.   know what technologies are available and their implications. As always
  1142.   there can be some tradeoffs with respect to speed, reliability, power,
  1143.   flexibility, ease of use and complexity.
  1144.  
  1145.   4.3.1.  RAID
  1146.  
  1147.   This is a method of increasing reliability, speed or both by using
  1148.   multiple disks in parallel thereby decreasing access time and
  1149.   increasing transfer speed. A checksum or mirroring system can be used
  1150.   to increase reliability.  Large servers can take advantage of such a
  1151.   setup but it might be overkill for a single user system unless you
  1152.   already have a large number of disks available. See other documents
  1153.   and FAQs for more information.
  1154.  
  1155.   For Linux one can set up a RAID system using either software (the md
  1156.   module in the kernel), a Linux compatible controller card (PCI-to-
  1157.   SCSI) or a SCSI-to-SCSI controller. Check the documentation for what
  1158.   controllers can be used. A hardware solution is usually faster, and
  1159.   perhaps also safer, but comes at a significant cost.
  1160.  
  1161.   SCSI-to-SCSI controllers are usually implemented as complete cabinets
  1162.   with drives and a controller that connects to the computer with a
  1163.   second SCSI bus. This makes the entire cabinet of drives look like a
  1164.   single large, fast SCSI drive and requires no special RAID driver. The
  1165.   disadvantage is that the SCSI bus connecting the cabinet to the
  1166.   computer becomes a bottleneck.
  1167.  
  1168.   PCI-to-SCSI are as the name suggests, connected to the high speed PCI
  1169.   bus and is therefore not suffering from the same bottleneck as the
  1170.   SCSI-to-SCSI controllers. These controllers require special drivers
  1171.   but you also get the means of controlling the RAID configuration over
  1172.   the network which simplifies management.
  1173.  
  1174.   Currently the only supported SCSI RAID controller cards are the
  1175.   SmartCache I/III/IV and SmartRAID I/III/IV controller families from
  1176.   DPT. These controllers are supported by the EATA-DMA driver in the
  1177.   standard kernel. This company also has an informative home page
  1178.   <http://www.dpt.com> which also describes various general aspects of
  1179.   RAID and SCSI in addition to the product related information.
  1180.  
  1181.   More information from  the author of the DPT controller drivers (EATA*
  1182.   drivers) can be found at his pages on SCSI <http://www.uni-
  1183.   mainz.de/~neuffer/scsi> and DPT <http://www.uni-
  1184.   mainz.de/~neuffer/scsi/dpt>.
  1185.  
  1186.   SCSI-to-SCSI-controllers are small computers themselves, often with a
  1187.   substantial amount of cache RAM. To the host system they mask
  1188.   themselves as a gigantic, fast and reliable SCSI disk whereas to their
  1189.   disks they look like the computer's SCSI host adapter. Some of these
  1190.   controllers have the option to talk to multiple hosts simultaneously.
  1191.   Since these controllers look to the host as a normal, albeit large
  1192.   SCSI drive they need no special support from the host system. Usually
  1193.   they are configured via the front panel or with a vt100 terminal
  1194.   emulator connected to their on-board serial interface.
  1195.  
  1196.   Very recently I have heard that Syred also makes SCSI-to-SCSI
  1197.   controllers that are supported under Linux. I have no more information
  1198.   about this yet but will come back with more information soon. In the
  1199.   mean time check out their home <http://www.syred.com> pages for more
  1200.   information.
  1201.  
  1202.   RAID comes in many levels and flavours which I will give a brief
  1203.   overview of this here. Much has been written about it and the
  1204.   interested reader is recommended to read more about this in the RAID
  1205.   FAQ.
  1206.  
  1207.   ╖  RAID 0 is not redundant at all but offers the best throughput of
  1208.      all levels here. Data is striped across a number of drives so read
  1209.      and write operations take place in parallel across all drives. On
  1210.      the other hand if a single drive fail then everything is lost. Did
  1211.      I mention backups?
  1212.  
  1213.   ╖  RAID 1 is the most primitive method of obtaining redundancy by
  1214.      duplicating data across all drives. Naturally this is massively
  1215.      wasteful but you get one substantial advantage which is fast
  1216.      access.  The drive that access the data first wins. Transfers are
  1217.      not any faster than for a single drive, even though you might get
  1218.      some faster read transfers by using one track reading per drive.
  1219.  
  1220.      Also if you have only 2 drives this is the only method of achieving
  1221.      redundancy.
  1222.  
  1223.   ╖  RAID 2 and 4 are not so common and are not covered here.
  1224.  
  1225.   ╖  RAID 3 uses a number of disks (at least 2) to store data in a
  1226.      striped RAID 0 fashion. It also uses an additional redundancy disk
  1227.      to store the XOR sum of the data from the data disks. Should the
  1228.      redundancy disk fail, the system can continue to operate as if
  1229.      nothing happened. Should any single data disk fail the system can
  1230.      compute the data on this disk from the information on the
  1231.      redundancy disk and all remaining disks. Any double fault will
  1232.      bring the whole RAID set off-line.
  1233.  
  1234.      RAID 3 makes sense only with at least 2 data disks (3 disks
  1235.      including the redundancy disk). Theoretically there is no limit for
  1236.      the number of disks in the set, but the probability of a fault
  1237.      increases with the number of disks in the RAID set. Usually the
  1238.      upper limit is 5 to 7 disks in a single RAID set.
  1239.  
  1240.      Since RAID 3 stores all redundancy information on a dedicated disk
  1241.      and since this information has to be updated whenever a write to
  1242.      any data disk occurs, the overall write speed of a RAID 3 set is
  1243.      limited by the write speed of the redundancy disk. This, too, is a
  1244.      limit for the number of disks in a RAID set. The overall read speed
  1245.      of a RAID 3 set with all data disks up and running is that of a
  1246.      RAID 0 set with that number of data disks. If the set has to
  1247.      reconstruct data stored on a failed disk from redundant
  1248.      information, the performance will be severely limited: All disks in
  1249.      the set have to be read and XOR-ed to compute the missing
  1250.      information.
  1251.  
  1252.   ╖  RAID 5 is just like RAID 3, but the redundancy information is
  1253.      spread on all disks of the RAID set. This improves write
  1254.      performance, because load is distributed more evenly between all
  1255.      available disks.
  1256.  
  1257.   There are also hybrids available based on RAID 1 and one other level.
  1258.   Many combinations are possible but I have only seen a few referred to.
  1259.   These are more complex than the above mentioned RAID levels.
  1260.  
  1261.   RAID 0/1 combines striping with duplication which gives very high
  1262.   transfers combined with fast seeks as well as redundancy. The
  1263.   disadvantage is high disk consumption as well as the above mentioned
  1264.   complexity.
  1265.  
  1266.   RAID 1/5 combines the speed and redundancy benefits of RAID5 with the
  1267.   fast seek of RAID1. Redundancy is improved compared to RAID 0/1 but
  1268.   disk consumption is still substantial. Implementing such a system
  1269.   would involve typically more than 6 drives, perhaps even several
  1270.   controllers or SCSI channels.
  1271.  
  1272.   4.3.2.  AFS, Veritas and Other Volume Management Systems
  1273.  
  1274.   Although multiple partitions and disks have the advantage of making
  1275.   for more space and higher speed and reliability there is a significant
  1276.   snag: if for instance the /tmp partition is full you are in trouble
  1277.   even if the news spool is empty, as it is not easy to retransfer
  1278.   quotas across partitions. Volume management is a system that does just
  1279.   this and AFS and Veritas are two of the best known examples. Some also
  1280.   offer other file systems like log file systems and others optimised
  1281.   for reliability or speed. Note that Veritas is not available (yet) for
  1282.   Linux and it is not certain they can sell kernel modules without
  1283.   providing source for their proprietary code, this is just mentioned
  1284.   for information on what is out there. Still, you can check their home
  1285.   page <http://www.veritas.com> to see how such systems function.
  1286.  
  1287.   Derek Atkins, of MIT, ported AFS to Linux and has also set up the
  1288.   Linux AFS mailing List for this which is open to the public.  Requests
  1289.   to join the list should go to Request and finally bug reports should
  1290.   be directed to Bug Reports.
  1291.  
  1292.   Important: as AFS uses encryption it is restricted software and cannot
  1293.   easily be exported from the US. AFS is now sold by Transarc and they
  1294.   have set up a www site. The directory structure there has been
  1295.   reorganized recently so I cannot give a more accurate URL than just
  1296.   the Transarc Home Page <http://www.transarc.com> which lands you in
  1297.   the root of the web site. There you can also find much general
  1298.   information as well as a FAQ.
  1299.  
  1300.   The is now also development based on the last free sources of AFS.
  1301.  
  1302.   Volume management is for the time being an area where Linux is
  1303.   lacking.  Someone has recently started a virtual partition system
  1304.   project that will reimplement many of the volume management functions
  1305.   found in IBM's AIX system.
  1306.  
  1307.   4.3.3.  Linux md Kernel Patch
  1308.  
  1309.   There is however one kernel project that attempts to do some of this,
  1310.   md, which has been part of the kernel distributions since 1.3.69.
  1311.   Currently providing spanning and RAID it is still in early development
  1312.   and people are reporting varying degrees of success as well as total
  1313.   wipe out. Use with caution.
  1314.  
  1315.   Currently it offers linear mode and RAID levels 0,1,4,5; all in
  1316.   various stages of development and reliability with linear mode and
  1317.   RAID levels 0 and 1 being the most stable.  It is also possible to
  1318.   stack some levels, for instance mirroring (RAID 1) two pairs of
  1319.   drives, each pair set up as striped disks (RAID 0), which offers the
  1320.   speed of RAID 0 combined with the reliability of RAID 1.
  1321.  
  1322.   Think very carefully what drives you combine so you can operate all
  1323.   drives in parallel, which gives you better performance and less wear.
  1324.   Read more about this in the documentation that comes with md.
  1325.  
  1326.   4.3.4.  General File System Consideration
  1327.  
  1328.   In the Linux world ext2fs is well established as a general purpose
  1329.   system.  Still for some purposes others can be a better choice. News
  1330.   spools lend themselves to a log file based system whereas high
  1331.   reliability data might need other formats. This is a hotly debated
  1332.   topic and there are currently few choices available but work is
  1333.   underway. Log file systems also have the advantage of very fast file
  1334.   checking. Mail servers in the 100GB class can suffer file checks
  1335.   taking several days before becoming operational after rebooting.
  1336.  
  1337.   The Minix file system is the oldest one, used in some rescue disk
  1338.   systems but otherwise very little used these days. At one time the
  1339.   Xiafs was a strong contender to the standard for Linux but seems to
  1340.   have fallen behind these days.
  1341.  
  1342.   Adam Richter from Yggdrasil posted recently that they have been
  1343.   working on a compressed log file based system but that this project is
  1344.   currently on hold. Nevertheless a non-working version is available on
  1345.   their FTP server. Check out the Yggdrasil ftp server
  1346.   <ftp://ftp.yggdrasil.com/private/adam> where special patched versions
  1347.   of the kernel can be found.  Hopefully this will be rolled into the
  1348.   mainstream kernel in the near future.
  1349.  
  1350.   As of July, 23th 1997 Hans Reiser <mailto:reiser (at) RICOCHET.NET>
  1351.   has put up the source to his tree based reiserfs
  1352.   <http://idiom.com/~beverly/reiserfs.html> on the web. While his
  1353.   filesystem has some very interesting features and is much faster than
  1354.   ext2fs, it is still very experimental and difficult to integrate with
  1355.   the standard kernel. Expect some interesting developments in the
  1356.   future - this is different from your "average log based file system
  1357.   for Linux" project, because Hans already has working code.
  1358.  
  1359.   There is room for access control lists (ACL) and other unimplemented
  1360.   features in the existing ext2fs, stay tuned for future updates. There
  1361.   has been some talk about adding on the fly compression too.
  1362.  
  1363.   There is also an encrypted file system available but again as this is
  1364.   under export control from the US, make sure you get it from a legal
  1365.   place.
  1366.  
  1367.   File systems is an active field of academic and industrial research
  1368.   and development, the results of which are quite often freely
  1369.   available. Linux has in many cases been a development tool in such
  1370.   activities so you can expect a lot of continuous work in this field,
  1371.   stay tuned for the latest development.
  1372.  
  1373.   4.3.5.  CD-ROM File Systems
  1374.  
  1375.   There has been a number of file systems available for use on CD-ROM
  1376.   systems and one of the earliest one was the High Sierra format,
  1377.   supposedly named after the hotel where the final agreement took place.
  1378.   This was the precursor to the ISO 9660 format which is supported by
  1379.   Linux.  Later there were the Rock Ridge extensions which added file
  1380.   system features such as long filenames, permissions and more.
  1381.  
  1382.   The Linux iso9660 file system supports both High Sierra as well as
  1383.   Rock Ridge extensions.
  1384.  
  1385.   However, once again Microsoft decided it should create another
  1386.   standard and their latest effort here is called Joliet and offers some
  1387.   internationalisation features. This is at the time of writing not yet
  1388.   available in the standard kernel releases but exists in beta versions.
  1389.   Hopefully this should soon work its way into the standard kernel.
  1390.  
  1391.   In a recent Usenet News posting hpa (at) transmeta.com (H. Peter
  1392.   Anvin) writes the following the following interesting piece of trivia:
  1393.  
  1394.        Actually, Joliet is a city outside Chicago; best known for being the
  1395.        site of the prison where Elwood was locked up in the movie "Blues
  1396.        Brothers."  Rock Ridge (the UNIX extensions to ISO 9660) is named
  1397.        after the (fictional) town in the movie "Blazing Saddles."
  1398.  
  1399.   4.3.6.  Compression
  1400.  
  1401.   Disk versus file compression is a hotly debated topic especially
  1402.   regarding the added danger of file corruption. Nevertheless there are
  1403.   several options available for the adventurous administrators. These
  1404.   take on many forms, from kernel modules and patches to extra libraries
  1405.   but note that most suffer various forms of limitations such as being
  1406.   read-only. As development takes place at neck breaking speed the specs
  1407.   have undoubtedly changed by the time you read this. As always: check
  1408.   the latest updates yourself. Here only a few references are given.
  1409.  
  1410.   ╖  DouBle features file compression with some limitations.
  1411.  
  1412.   ╖  Zlibc adds transparent on-the-fly decompression of files as they
  1413.      load.
  1414.  
  1415.   ╖  there are many modules available for reading compressed files or
  1416.      partitions that are native to various other operating systems
  1417.      though currently most of these are read-only.
  1418.  
  1419.   ╖  dmsdos (currently in version 0.8.0a) offer many of the compression
  1420.      options available for DOS and Windows. It is not yet complete but
  1421.      work is ongoing and new features added regularly.
  1422.  
  1423.   Also there is the user file system (userfs) that allows FTP based file
  1424.   system and some compression (arcfs) plus fast prototyping and many
  1425.   other features.
  1426.  
  1427.   Recent kernels feature the loop or loopback device which can be used
  1428.   to put a complete file system within a file. There are some
  1429.   possibilities for using this for making new file systems with
  1430.   compression, tarring, encryption etc.
  1431.  
  1432.   Note that this device is unrelated to the network loopback device.
  1433.  
  1434.   Very recently a compression package that extends ext2fs was announced.
  1435.   It is still under testing and will therefore mainly be of interest for
  1436.   kernel hackers but should soon gain stability for wider use.
  1437.  
  1438.   4.3.7.  Physical Track Positioning
  1439.  
  1440.   This trick used to be very important when drives were slow and small,
  1441.   and some file systems used to take the varying characteristics into
  1442.   account when placing files. Although higher overall speed, on board
  1443.   drive and controller caches and intelligence has reduced the effect of
  1444.   this.
  1445.  
  1446.   Nevertheless there is still a little to be gained even today.  As we
  1447.   know, "world dominance" is soon within reach but to achieve this
  1448.   "fast" we need to employ all the tricks we can use
  1449.  
  1450.   To understand the strategy we need to recall this near ancient piece
  1451.   of knowledge and the properties of the various track locations.  This
  1452.   is based on the fact that transfer speeds generally increase for
  1453.   tracks further away from the spindle, as well as the fact that it is
  1454.   faster to seek to or from the central tracks than to or from the inner
  1455.   or outer tracks.
  1456.  
  1457.   Most drives use disks running at constant angular velocity but use
  1458.   (fairly) constant data density across all tracks. This means that you
  1459.   will get much higher transfer rates on the outer tracks than on the
  1460.   inner tracks; a characteristics which fits the requirements for large
  1461.   libraries well.
  1462.  
  1463.   Newer disks use a logical geometry mapping which differs from the
  1464.   actual physical mapping which is transparently mapped by the drive
  1465.   itself.  This makes the estimation of the "middle" tracks a little
  1466.   harder.
  1467.  
  1468.   In most cases track 0 is at the outermost track and this is the
  1469.   general assumption most people use. Still, it should be kept in mind
  1470.   that there are no guarantees this is so.
  1471.  
  1472.      Inner
  1473.         tracks are usually slow in transfer, and lying at one end of the
  1474.         seeking position it is also slow to seek to.
  1475.  
  1476.         This is more suitable to the low end directories such as DOS,
  1477.         root and print spools.
  1478.      Middle
  1479.         tracks are on average faster with respect to transfers than
  1480.         inner tracks and being in the middle also on average faster to
  1481.         seek to.
  1482.  
  1483.         This characteristics is ideal for the most demanding parts such
  1484.         as swap, /tmp and /var/tmp.
  1485.  
  1486.      Outer
  1487.         tracks have on average even faster transfer characteristics but
  1488.         like the inner tracks are at the end of the seek so
  1489.         statistically it is equally slow to seek to as the inner tracks.
  1490.  
  1491.         Large files such as libraries would benefit from a place here.
  1492.  
  1493.   Hence seek time reduction can be achieved by positioning frequently
  1494.   accessed tracks in the middle so that the average seek distance and
  1495.   therefore the seek time is short. This can be done either by using
  1496.   fdisk or cfdisk to make a partition on the middle tracks or by first
  1497.   making a file (using dd) equal to half the size of the entire disk
  1498.   before creating the files that are frequently accessed, after which
  1499.   the dummy file can be deleted. Both cases assume starting from an
  1500.   empty disk.
  1501.  
  1502.   The latter trick is suitable for news spools where the empty directory
  1503.   structure can be placed in the middle before putting in the data
  1504.   files.  This also helps reducing fragmentation a little.
  1505.  
  1506.   This little trick can be used both on ordinary drives as well as RAID
  1507.   systems. In the latter case the calculation for centring the tracks
  1508.   will be different, if possible. Consult the latest RAID manual.
  1509.  
  1510.   5.  Other Operating Systems
  1511.  
  1512.   Many Linux users have several operating systems installed, often
  1513.   necessitated by hardware setup systems that run under other operating
  1514.   systems, typically DOS or some flavour of Windows. A small section on
  1515.   how best to deal with this is therefore included here.
  1516.  
  1517.   5.1.  DOS
  1518.  
  1519.   Leaving aside the debate on weather or not DOS qualifies as an
  1520.   operating system one can in general say that it has little
  1521.   sophistication with respect to disk operations. The more important
  1522.   result of this is that there can be severe difficulties in running
  1523.   various versions of DOS on large drives, and you are therefore
  1524.   strongly recommended in reading the Large Drives mini-HOWTO. One
  1525.   effect is that you are often better off placing DOS on low track
  1526.   numbers.
  1527.  
  1528.   Having been designed for small drives it has a rather unsophisticated
  1529.   file system (FAT) which when used on large drives will allocate
  1530.   enormous block sizes. It is also prone to block fragmentation which
  1531.   will after a while cause excessive seeks and slow effective transfers.
  1532.  
  1533.   One solution to this is to use a defragmentation program regularly but
  1534.   it is strongly recommended to back up data and verify the disk before
  1535.   defragmenting. All versions of DOS have chkdsk that can do some disk
  1536.   checking, newer versions also have scandisk which is somewhat better.
  1537.   There are many defragmentation programs available, some versions have
  1538.   one called defrag. Norton Utilities have a large suite of disk tools
  1539.   and there are many others available too.
  1540.  
  1541.   As always there are snags, and this particular snake in our drive
  1542.   paradise is called hidden files. Some vendors started to use these for
  1543.   copy protection schemes and would not take kindly to being moved to a
  1544.   different place on the drive, even if it remained in the same place in
  1545.   the directory structure. The result of this was that newer
  1546.   defragmentation programs will not touch any hidden file, which in turn
  1547.   reduces the effect of defragmentation.
  1548.  
  1549.   Being a single tasking, single threading and single most other things
  1550.   operating system there is very little gains in using multiple drives
  1551.   unless you use a drive controller with built in RAID support of some
  1552.   kind.
  1553.  
  1554.   There are a few utilities called join and subst which can do some
  1555.   multiple drive configuration but there is very little gains for a lot
  1556.   of work. Some of these commands have been removed in newer versions.
  1557.  
  1558.   In the end there is very little you can do, but not all hope is lost.
  1559.   Many programs need fast, temporary storage, and the better behaved
  1560.   ones will look for environment variables called TMPDIR or TEMPDIR
  1561.   which you can set to point to another drive. This is often best done
  1562.   in autoexec.bat.
  1563.  
  1564.   ______________________________________________________________________
  1565.   SET TMPDIR=E:/TMP
  1566.   ______________________________________________________________________
  1567.  
  1568.   Not only will this possibly gain you some speed but also it can reduce
  1569.   fragmentation.
  1570.  
  1571.   There have been reports about difficulties in removing multiple
  1572.   primary partitions using the fdisk program that comes with DOS. Should
  1573.   this happen you can instead use a Linux rescue disk with Linux fdisk
  1574.   to repair the system.
  1575.  
  1576.   5.2.  Windows
  1577.  
  1578.   Most of the above points are valid for Windows too, with the exception
  1579.   of Windows95 which apparently has better disk handling, which will get
  1580.   better performance out of SCSI drives.
  1581.  
  1582.   A useful thing is the introduction of long filenames, to read these
  1583.   from Linux you will need the vfat file system for mounting these
  1584.   partitions.
  1585.  
  1586.   The most important thing is the introduction of the new file system
  1587.   FAT32 which is better suited to large drives. The snag is that there
  1588.   is very little support for this today, not even in NT 4.0 or many
  1589.   drive utility systems. A stable driver for Linux is coming soon but is
  1590.   not yet ready for prime time. Stay tuned for updates.
  1591.  
  1592.   Disk fragmentation is still a problem. Some of this can be avoided by
  1593.   doing a defragmentation immediately before and immediately after
  1594.   installing large programs or systems. I use this scheme at work and
  1595.   have found it to work quite well. Purging unused files and emptying
  1596.   the waste basket first can improve defragmentation further.
  1597.  
  1598.   Windows also use swap drives, redirecting this to another drive can
  1599.   give you some performance gains. There are several mini-HOWTOs telling
  1600.   you how best to share swap space between various operating systems.
  1601.   Very recently someone started a project supporting ext2fs support for
  1602.   Win95 which you can read about at this web site
  1603.   <http://www.globalxs.nl/home/p/pvs/>.
  1604.  
  1605.   5.3.  OS/2
  1606.  
  1607.   The only special note here is that you can get a file system driver
  1608.   for OS/2 that can read an ext2fs partition.
  1609.  
  1610.   5.4.  NT
  1611.  
  1612.   This is a more serious system featuring most buzzwords known to
  1613.   marketing.  It is well worth noting that it features software striping
  1614.   and other more sophisticated setups. Check out the drive manager in
  1615.   the control panel.  I do not have easy access to NT, more details on
  1616.   this can take a bit of time.
  1617.  
  1618.   One important snag was recently reported by acahalan at cs.uml.edu :
  1619.   (reformatted from a Usenet News posting)
  1620.  
  1621.   NT DiskManager has a serious bug that can corrupt your disk when you
  1622.   have several (more than one?) extended partitions.  Microsoft provides
  1623.   an emergency fix program at their web site. See the knowledge base
  1624.   <http://www.microsoft.com/kb/> for more.  (This affects Linux users,
  1625.   because Linux users have extra partitions)
  1626.  
  1627.   5.5.  Sun OS
  1628.  
  1629.   There is a little bit of confusion in this area between Sun OS vs.
  1630.   Solaris.  Strictly speaking Solaris is just Sun OS 5.x packaged with
  1631.   Openwindows and a few other things. If you run Solaris, just type
  1632.   uname -a to see your version. Parts of the reason for this confusion
  1633.   is that Sun Microsystems used to use an OS from the BSD family,
  1634.   albeight with a few bits and pieces from elsewhere as well as things
  1635.   made by themselves. This was the situation up to Sun OS 4.x.y when
  1636.   they did a "strategic roadmap decision" and decided to switch over to
  1637.   the official Unix, System V, Release 4 (aka SVR5), and Sun OS 5 was
  1638.   created.  This made a lot of people unhappy. Also this was bundled
  1639.   with other things and marketed under the name Solaris, which currently
  1640.   stands at release 2.6 beta.
  1641.  
  1642.   5.5.1.  Sun OS 4
  1643.  
  1644.   This is quite familiar to most Linux users. Note however that the file
  1645.   system structure is quite different and does not conform to FSSTND so
  1646.   any planning must be based on the traditional structure. You can get
  1647.   some information by the man page on this: man hier. This is, like most
  1648.   manpages, rather brief but should give you a good start. If you are
  1649.   still confused by the structure it will at least be at a higher level.
  1650.  
  1651.   5.5.2.  Sun OS 5 (aka Solaris)
  1652.  
  1653.   This comes with a snazzy installation system that runs under
  1654.   Openwindows, it will help you in partitioning and formatting the
  1655.   drives before installing the system from CD-ROM. It will also fail if
  1656.   your drive setup is too far out, and as it takes a complete
  1657.   installation run from a full CD-ROM in a 1x only drive this failure
  1658.   will dawn on you after too long time. That is the experience we had
  1659.   where I work. Instead we installed everything onto one drive and then
  1660.   moved directories across.
  1661.  
  1662.   The default settings are sensible for most things, yet there remains a
  1663.   little oddity: swap drives. Even though the official manual recommends
  1664.   multiple swap drives (which are used in a similar fashion as on Linux)
  1665.   the default is to use only a single drive. It is recommended to change
  1666.   this as soon as possible.
  1667.  
  1668.   Sun OS 5 offers also a file system especially designed for temporary
  1669.   files, tmpfs. This is a kind of souped up RAM disk, and like ordinary
  1670.   RAM disks the contents is lost when the power goes. If space is scarce
  1671.   parts of the pseudo drive is swapped out, so in effect you store
  1672.   temporary files on the swap partition. Linux does not have such a file
  1673.   system; it has been discussed in the past but opinions were mixed. I
  1674.   would be interested in hearing comments on this.
  1675.  
  1676.   Also see the note on ``Combining swap and /tmp''.
  1677.  
  1678.   Trivia: There is a movie also called Solaris, a science fiction movie
  1679.   that is very, very long, slow and incomprehensible. This was often
  1680.   pointed out at the time Solaris (the OS) appeared...
  1681.  
  1682.   6.  Clusters
  1683.  
  1684.   In this section I will briefly touch on the ways machines can be
  1685.   connected together but this is so big a topic it could be a separate
  1686.   HOWTO in its own right, hint, hint. Also, strictly speaking, this
  1687.   section lies outside the scope of this HOWTO, so if you feel like
  1688.   getting fame etc. you could contact me and take over this part and
  1689.   turn it into a new document.
  1690.  
  1691.   These days computers gets outdated at an incredible rate. There is
  1692.   however no reason why old hardware could not be put to good use with
  1693.   Linux. Using an old and otherwise outdated computer as a network
  1694.   server can be both useful in its own right as well as a valuable
  1695.   educational exercise. Such a local networked cluster of computers can
  1696.   take on many forms but to remain within the charter of this HOWTO I
  1697.   will limit myself to the disk strategies.  Nevertheless I would hope
  1698.   someone else could take on this topic and turn it into a document on
  1699.   its own.
  1700.  
  1701.   This is an exciting area of activity today, and many forms of
  1702.   clustering is available today, ranging from automatic workload
  1703.   balancing over local network to more exotic hardware such as Scalable
  1704.   Coherent Interface (SCI) which gives a tight integration of machines,
  1705.   effectively turning them into a single machine. Various kinds of
  1706.   clustering has been available for larger machines for some time and
  1707.   the VAXcluster is perhaps a well known example of this. Clustering is
  1708.   done usually in order to share resources such as disk drives, printers
  1709.   and terminals etc, but also processing resources equally transparently
  1710.   between the computational nodes.
  1711.  
  1712.   There is no universal definition of clustering, in here it is taken to
  1713.   mean a network of machines that combine their resources to serve
  1714.   users. Admittedly this is a rather loose definition but this will
  1715.   change later.
  1716.  
  1717.   These days also Linux offers some clustering features but for a
  1718.   starter I will just describe a simple local network. It is a good way
  1719.   of putting old and otherwise unusable hardware to good use, as long as
  1720.   they can run Linux or something similar.
  1721.  
  1722.   One of the best ways of using an old machine is as a network server in
  1723.   which case the effective speed is more likely to be limited by network
  1724.   bandwidth rather than pure computational performance. For home use you
  1725.   can move the following functionality off to an older machine used as a
  1726.   server:
  1727.  
  1728.   ╖  news
  1729.  
  1730.   ╖  mail
  1731.  
  1732.   ╖  web proxy
  1733.  
  1734.   ╖  printer server
  1735.  
  1736.   ╖  modem server (PPP, SLIP, FAX, Voice mail)
  1737.  
  1738.   You can also NFS mount drives from the server onto your workstation
  1739.   thereby reducing drive space requirements. Still read the FSSTND to
  1740.   see what directories should not be exported. The best candidates for
  1741.   exporting to all machines are /usr and /var/spool and possibly
  1742.   /usr/local
  1743.  
  1744.   Most of the time even slow disks will deliver sufficient performance.
  1745.   On the other hand, if you do processing directly on the disks on the
  1746.   server or have very fast networking, you might want to rethink your
  1747.   strategy and use faster drives. Searching features on a web server or
  1748.   news database searches are two examples of this.
  1749.  
  1750.   Such a network can be an excellent way of learning system
  1751.   administration and building up your own toaster network, as it often
  1752.   is called. You can get more information on this in other HOWTOs but
  1753.   there are two important things you should keep in mind:
  1754.  
  1755.   ╖  Do not pull IP numbers out of thin air. Configure your inside net
  1756.      using IP numbers reserved for private use, and use your network
  1757.      server as a router that handles this IP masquerading.
  1758.  
  1759.   ╖  Remember that if you additionally configure the router as a
  1760.      firewall you might not be able to get to your own data from the
  1761.      outside, depending on the firewall configuration.
  1762.  
  1763.   The nyx network provides an example of a cluster in the sense defined
  1764.   here.  It consists of the following machines:
  1765.  
  1766.      nyx
  1767.         is one of the two user login machines and also provides some of
  1768.         the networking services.
  1769.  
  1770.      nox
  1771.         (aka nyx10) is the main user login machine and is also the mail
  1772.         server.
  1773.  
  1774.      noc
  1775.         is a dedicated news server. The news spool is made accessible
  1776.         through NFS mounting to nyx and nox.
  1777.  
  1778.      arachne
  1779.         (aka www) is the web server. Web pages are written by NFS
  1780.         mounting onto nox.
  1781.  
  1782.   There are also some more advanced clustering projects going, notably
  1783.  
  1784.   ╖  The Beowolf Project
  1785.      <http://cesdis.gsfc.nasa.gov/linux/beowulf/beowulf.html>
  1786.  
  1787.   ╖  The Genoa Active Message Machine (GAMMA)
  1788.      <http://www.disi.unige.it/project/gamma/>
  1789.  
  1790.   High-tech clustering requires high-tech interconnect, and SCI is one
  1791.   of them.  To find out more you can either look up the home page of
  1792.   Dolphin Interconnect Solutions <http://www.dolphinics.no/> which is
  1793.   one of the main actors in this field, or you can have a look at scizzl
  1794.   <http://www.scizzl.com/>.
  1795.  
  1796.   7.  Mount Points
  1797.  
  1798.   In designing the disk layout it is important not to split off the
  1799.   directory tree structure at the wrong points, hence this section.  As
  1800.   it is highly dependent on the FSSTND it has been put aside in a
  1801.   separate section, and will most likely have to be totally rewritten
  1802.   when FHS is released. Nobody knows when that will happen, and at the
  1803.   time of writing this a debate of near-religious qualities is taking
  1804.   place on the mailing list. In the meanwhile this will do.
  1805.  
  1806.   Remember that this is a list of where a separation can take place, not
  1807.   where it has to be. As always, good judgement is always required.
  1808.  
  1809.   Again only a rough indication can be given here. The values indicate
  1810.  
  1811.        0=don't separate here
  1812.        1=not recommended
  1813.         ...
  1814.        4=useful
  1815.        5=recommended
  1816.  
  1817.   In order to keep the list short, the uninteresting parts are removed.
  1818.  
  1819.   Directory   Suitability
  1820.   /
  1821.   |
  1822.   +-bin       0
  1823.   +-boot      0
  1824.   +-dev       0
  1825.   +-etc       0
  1826.   +-home      5
  1827.   +-lib       0
  1828.   +-mnt       0
  1829.   +-proc      0
  1830.   +-root      0
  1831.   +-sbin      0
  1832.   +-tmp       5
  1833.   +-usr       5
  1834.   | \
  1835.   | +-X11R6     3
  1836.   | +-bin       3
  1837.   | +-lib       4
  1838.   | +-local     4
  1839.   | | \
  1840.   | | +bin        2
  1841.   | | +lib        4
  1842.   | +-src       3
  1843.   |
  1844.   +-var       5
  1845.     \
  1846.     +-adm       0
  1847.     +-lib       2
  1848.     +-lock      1
  1849.     +-log       1
  1850.     +-preserve  1
  1851.     +-run       1
  1852.     +-spool     4
  1853.     | \
  1854.     | +-mail      3
  1855.     | +-mqueue    3
  1856.     | +-news      5
  1857.     | +-smail     3
  1858.     | +-uucp      3
  1859.     +-tmp       5
  1860.  
  1861.   There is of course plenty of adjustments possible, for instance a home
  1862.   user would not bother with splitting off the /var/spool hierarchy but
  1863.   a serious ISP should. The key here is usage.
  1864.  
  1865.   8.  Disk Layout
  1866.  
  1867.   With all this in mind we are now ready to embark on the layout. I have
  1868.   based this on my own method developed when I got hold of 3 old SCSI
  1869.   disks and boggled over the possibilities.
  1870.  
  1871.   The tables in the appendices are designed to simplify the mapping
  1872.   process. They have been designed to help you go through the process of
  1873.   optimizations as well as making an useful log in case of system
  1874.   repair. A few examples are also given.
  1875.  
  1876.   8.1.  Selection for partitioning
  1877.  
  1878.   Determine your needs and set up a list of all the parts of the file
  1879.   system you want to be on separate partitions and sort them in
  1880.   descending order of speed requirement and how much space you want to
  1881.   give each partition.
  1882.  
  1883.   The table in Appendix A `` '' is a useful tool to select what
  1884.   directories you should put on different partitions. It is sorted in a
  1885.   logical order with space for your own additions and notes about
  1886.   mounting points and additional systems. It is therefore NOT sorted in
  1887.   order of speed, instead the speed requirements are indicated by
  1888.   bullets ('o').
  1889.  
  1890.   If you plan to RAID make a note of the disks you want to use and what
  1891.   partitions you want to RAID. Remember various RAID solutions offers
  1892.   different speeds and degrees of reliability.
  1893.  
  1894.   (Just to make it simple I'll assume we have a set of identical SCSI
  1895.   disks and no RAID)
  1896.  
  1897.   8.2.  Mapping partitions to drives
  1898.  
  1899.   Then we want to place the partitions onto physical disks. The point of
  1900.   the following algorithm is to maximise parallelizing and bus capacity.
  1901.   In this example the drives are A, B and C and the partitions are
  1902.   987654321 where 9 is the partition with the highest speed requirement.
  1903.   Starting at one drive we 'meander' the partition line over and over
  1904.   the drives in this way:
  1905.  
  1906.                A : 9 4 3
  1907.                B : 8 5 2
  1908.                C : 7 6 1
  1909.  
  1910.   This makes the 'sum of speed requirements' the most equal across each
  1911.   drive.
  1912.  
  1913.   Use the table in Appendix B `` '' to select what drives to use for
  1914.   each partition in order to optimize for parallelicity.
  1915.  
  1916.   Note the speed characteristics of your drives and note each directory
  1917.   under the appropriate column. Be prepared to shuffle directories,
  1918.   partitions and drives around a few times before you are satisfied.
  1919.  
  1920.   8.3.  Sorting partitions on drives
  1921.  
  1922.   After that it is recommended to select partition numbering for each
  1923.   drive.
  1924.  
  1925.   Use the table in Appendix C `` '' to select partition numbers in order
  1926.   to optimize for track characteristics.  At the end of this you should
  1927.   have a table sorted in ascending partition number. Fill these numbers
  1928.   back into the tables in appendix A and B.
  1929.  
  1930.   You will find these tables useful when running the partitioning
  1931.   program (fdisk or cfdisk) and when doing the installation.
  1932.  
  1933.   8.4.  Optimizing
  1934.  
  1935.   After this there are usually a few partitions that have to be
  1936.   'shuffled' over the drives either to make them fit or if there are
  1937.   special considerations regarding speed, reliability, special file
  1938.   systems etc. Nevertheless this gives what this author believes is a
  1939.   good starting point for the complete setup of the drives and the
  1940.   partitions. In the end it is actual use that will determine the real
  1941.   needs after we have made so many assumptions. After commencing
  1942.   operations one should assume a time comes when a repartitioning will
  1943.   be beneficial.
  1944.  
  1945.   For instance if one of the 3 drives in the above mentioned example is
  1946.   very slow compared to the two others a better plan would be as
  1947.   follows:
  1948.  
  1949.                A : 9 6 5
  1950.                B : 8 7 4
  1951.                C : 3 2 1
  1952.  
  1953.   8.4.1.  Optimizing by characteristics
  1954.  
  1955.   Often drives can be similar in apparent overall speed but some
  1956.   advantage can be gained by matching drives to the file size
  1957.   distribution and frequency of access. Thus binaries are suited to
  1958.   drives with fast access that offer command queueing, and libraries are
  1959.   better suited to drives with larger transfer speeds where IDE offers
  1960.   good performance for the money.
  1961.  
  1962.   8.4.2.  Optimizing by drive parallelising
  1963.  
  1964.   Avoid drive contention by looking at tasks: for instance if you are
  1965.   accessing /usr/local/bin chances are you will soon also need files
  1966.   from /usr/local/lib so placing these at separate drives allows less
  1967.   seeking and possible parallel operation and drive caching. It is quite
  1968.   possible that choosing what may appear less than ideal drive
  1969.   characteristics will still be advantageous if you can gain parallel
  1970.   operations. Identify common tasks, what partitions they use and try to
  1971.   keep these on separate physical drives.
  1972.  
  1973.   Just to illustrate my point I will give a few examples of task
  1974.   analysis here.
  1975.  
  1976.      Office software
  1977.         such as editing, word processing and spreadsheets are typical
  1978.         examples of low intensity software both in terms of CPU and disk
  1979.         intensity. However, should you have a single server for a huge
  1980.         number of users you should not forget that most such software
  1981.         have auto save facilities which cause extra traffic, usually on
  1982.         the home directories. Splitting users over several drives would
  1983.         reduce contention.
  1984.  
  1985.      News
  1986.         readers also feature auto save features on home directories so
  1987.         ISPs should consider separating home directories
  1988.  
  1989.         News spools are notorious for their deeply nested directories
  1990.         and their large number of very small files. Loss of a news spool
  1991.         partition is not a big problem for most people, too, so they are
  1992.         good candidates for a RAID 0 setup with many small disks to
  1993.         distribute the many seeks among multiple spindles. It is
  1994.         recommended in the manuals and FAQs for the INN news server to
  1995.         put news spool and .overview files on separate drives for larger
  1996.         installations.
  1997.  
  1998.         There is also a web page dedicated to INN optimising
  1999.         <http://www.spinne.com/usenet/inn-perf.html> well worth reading.
  2000.  
  2001.      Database
  2002.         applications can be demanding both in terms of drive usage and
  2003.         speed requirements. The details are naturally application
  2004.         specific, read the documentation carefully with disk
  2005.         requirements in mind. Also consider RAID both for performance
  2006.         and reliability.
  2007.  
  2008.      E-mail
  2009.         reading and sending involves home directories as well as in- and
  2010.         outgoing spool files. If possible keep home directories and
  2011.         spool files on separate drives. If you are a mail server or a
  2012.         mail hub consider putting in- and outgoing spool directories on
  2013.         separate drives.
  2014.  
  2015.         Losing mail is an extremely bad thing, if you are and ISP or
  2016.         major hub. Think about RAIDing your mail spool and consider
  2017.         frequent backups.
  2018.  
  2019.      Software development
  2020.         can require a large number of directories for binaries,
  2021.         libraries, include files as well as source and project files. If
  2022.         possible split as much as possible across separate drives. On
  2023.         small systems you can place /usr/src and project files on the
  2024.         same drive as the home directories.
  2025.  
  2026.      Web browsing
  2027.         is becoming more and more popular. Many browsers have a local
  2028.         cache which can expand to rather large volumes. As this is used
  2029.         when reloading pages or returning to the previous page, speed is
  2030.         quite important here. If however you are connected via a well
  2031.         configured proxy server you do not need more than typically a
  2032.         few megabytes per user for a session.  See also the sections on
  2033.         ``Home Directories'' and ``WWW''.
  2034.  
  2035.   8.5.  Usage requirements
  2036.  
  2037.   When you get a box of 10 or so CD-ROMs with a Linux distribution and
  2038.   the entire contents of the big FTP sites it can be tempting to install
  2039.   as much as your drives can take. Soon, however, one would find that
  2040.   this leaves little room to grow and that it is easy to bite over more
  2041.   than can be chewed, at least in polite company. Therefore I will make
  2042.   a few comments on a few points to keep in mind when you plan out your
  2043.   system. Comments here are actively sought.
  2044.      Testing
  2045.         Linux is simple and you don't even need a hard disk to try it
  2046.         out, if you can get the boot floppies to work you are likely to
  2047.         get it to work on your hardware. If the standard kernel does not
  2048.         work for you, do not forget that often there can be special boot
  2049.         disk versions available for unusual hardware combinations that
  2050.         can solve your initial problems until you can compile your own
  2051.         kernel.
  2052.  
  2053.      Learning
  2054.         about operating system is something Linux excels in, there is
  2055.         plenty of documentation and the source is available. A single
  2056.         drive with 50MB is enough to get you started with a shell, a few
  2057.         of the most frequently used commands and utilities.
  2058.  
  2059.      Hobby
  2060.         use or more serious learning requires more commands and
  2061.         utilities but a single drive is still all it takes, 500MB should
  2062.         give you plenty of room, also for sources and documentation.
  2063.  
  2064.      Serious
  2065.         software development or just serious hobby work requires even
  2066.         more space. At this stage you have probably a mail and news feed
  2067.         that requires spool files and plenty of space. Separate drives
  2068.         for various tasks will begin to show a benefit. At this stage
  2069.         you have probably already gotten hold of a few drives too. Drive
  2070.         requirements gets harder to estimate but I would expect 2-4GB to
  2071.         be plenty, even for a small server.
  2072.  
  2073.      Servers
  2074.         come in many flavours, ranging from mail servers to full sized
  2075.         ISP servers. A base of 2GB for the main system should be
  2076.         sufficient, then add space and perhaps also drives for separate
  2077.         features you will offer. Cost is the main limiting factor here
  2078.         but be prepared to spend a bit if you wish to justify the "S" in
  2079.         ISP. Admittedly, not all do it.
  2080.  
  2081.   8.6.  Servers
  2082.  
  2083.   Big tasks require big drives and a separate section here. If possible
  2084.   keep as much as possible on separate drives. Some of the appendices
  2085.   detail the setup of a small departmental server for 10-100 users. Here
  2086.   I will present a few consideration for the higher end servers. In
  2087.   general you should not be afraid of using RAID, not only because it is
  2088.   fast and safe but also because it can make growth a little less
  2089.   painful. All the notes below come as additions to the points mentioned
  2090.   earlier.
  2091.  
  2092.   Popular servers rarely just happens, rather they grow over time and
  2093.   this demands both generous amounts of disk space as well as a good net
  2094.   connection.  In many of these cases it might be a good idea to reserve
  2095.   entire SCSI drives, in singles or as arrays, for each task. This way
  2096.   you can move the data should the computer fail. Note that transferring
  2097.   drives across computers is not simple and might not always work,
  2098.   especially in the case of IDE drives. Drive arrays require careful
  2099.   setup in order to reconstruct the data correctly, so you might want to
  2100.   keep a paper copy of your fstab file as well as a note of SCSI IDs.
  2101.  
  2102.   8.6.1.  Home directories
  2103.  
  2104.   Estimate how many drives you will need, if this is more than 2 I would
  2105.   recommend RAID, strongly. If not you should separate users across your
  2106.   drives dedicated to users based on some kind of simple hashing
  2107.   algorithm.  For instance you could use the first 2 letters in the user
  2108.   name, so jbloggs is put on /u/j/b/jbloggs where /u/j is a symbolic
  2109.   link to a physical drive so you can get a balanced load on your
  2110.   drives.
  2111.  
  2112.   8.6.2.  Anonymous FTP
  2113.  
  2114.   This is an essential service if you are serious about service. Good
  2115.   servers are well maintained, documented, kept up to date, and
  2116.   immensely popular no matter where in the world they are located. The
  2117.   big server ftp.funet.fi is an excellent example of this.
  2118.  
  2119.   In general this is not a question of CPU but of network bandwidth.
  2120.   Size is hard to estimate, mainly it is a question of ambition and
  2121.   service attitudes. I believe the big archive at ftp.cdrom.com is a
  2122.   *BSD machine with 50GB disk. Also memory is important for a dedicated
  2123.   FTP server, about 256MB RAM would be sufficient for a very big server,
  2124.   whereas smaller servers can get the job done well with 64MB RAM.
  2125.   Network connections would still be the most important factor.
  2126.  
  2127.   8.6.3.  WWW
  2128.  
  2129.   For many this is the main reason to get onto the Internet, in fact
  2130.   many now seem to equate the two. In addition to being network
  2131.   intensive there is also a fair bit of drive activity related to this,
  2132.   mainly regarding the caches. Keeping the cache on a separate, fast
  2133.   drive would be beneficial. Even better would be installing a caching
  2134.   proxy server. This way you can reduce the cache size for each user and
  2135.   speed up the service while at the same time cut down on the bandwidth
  2136.   requirements.
  2137.  
  2138.   With a caching proxy server you need a fast set of drives, RAID0 would
  2139.   be ideal as reliability is not important here. Higher capacity is
  2140.   better but about 2GB should be sufficient for most. Remember to match
  2141.   the cache period to the capacity and demand. Too long periods would on
  2142.   the other hand be a disadvantage, if possible try to adjust based on
  2143.   the URL. For more information check up on the most used servers such
  2144.   as Harvest, Squid <http://www.nlanr.net/Squid> and the one from
  2145.   Netscape.
  2146.  
  2147.   8.6.4.  Mail
  2148.  
  2149.   Handling mail is something most machines do to some extent. The big
  2150.   mail servers, however, come into a class of their own. This is a
  2151.   demanding task and a big server can be slow even when connected to
  2152.   fast drives and a good net feed. In the Linux world the big server at
  2153.   vger.rutgers.edu is a well known example. Unlike a news service which
  2154.   is distributed and which can partially reconstruct the spool using
  2155.   other machines as a feed, the mail servers are centralised. This makes
  2156.   safety much more important, so for a major server you should consider
  2157.   a RAID solution with emphasize on reliability. Size is hard to
  2158.   estimate, it all depends on how many lists you run as well as how many
  2159.   subscribers you have.
  2160.  
  2161.   8.6.5.  News
  2162.  
  2163.   This is definitely a high volume task, and very dependent on what news
  2164.   groups you subscribe to. On Nyx there is a fairly complete feed and
  2165.   the spool files consume about 17GB. The biggest groups are no doubt in
  2166.   the alt.binary.* hierarchy, so if you for some reason decide not to
  2167.   get these you can get a good service with perhaps 12GB. Still others,
  2168.   that shall remain nameless, feel 2GB is sufficient to claim ISP
  2169.   status.  In this case news expires so fast I feel the spelling IsP is
  2170.   barely justified.
  2171.  
  2172.   8.6.6.  Others
  2173.  
  2174.   There are many services available on the net and even though many have
  2175.   been put somewhat in the shadows by the web. Nevertheless, services
  2176.   like archie, gopher and wais just to name a few, still exist and
  2177.   remain valuable tools on the net. If you are serious about starting a
  2178.   major server you should also consider these services. Determining the
  2179.   required volumes is hard, it all depends on popularity and demand.
  2180.   Providing good service inevitably has its costs, disk space is just
  2181.   one of them.
  2182.  
  2183.   8.7.  Pitfalls
  2184.  
  2185.   The dangers of splitting up everything into separate partitions are
  2186.   briefly mentioned in the section about volume management. Still,
  2187.   several people have asked me to emphasize this point more strongly:
  2188.   when one partition fills up it cannot grow any further, no matter if
  2189.   there is plenty of space in other partitions.
  2190.  
  2191.   In particular look out for explosive growth in the news spool
  2192.   (/var/spool/news). For multi user machines with quotas keep an eye on
  2193.   /tmp and /var/tmp as some people try to hide their files there, just
  2194.   look out for filenames ending in gif or jpeg...
  2195.  
  2196.   In fact, for single physical drives this scheme offers very little
  2197.   gains at all, other than making file growth monitoring easier (using
  2198.   'df') and physical track positioning. Most importantly there is no
  2199.   scope for parallel disk access. A freely available volume management
  2200.   system would solve this but this is still some time in the future.
  2201.   However, when more specialised file systems become available even a
  2202.   single disk could benefit from being divided into several partitions.
  2203.  
  2204.   8.8.  Compromises
  2205.  
  2206.   One way to avoid the aforementioned pitfalls is to only set off fixed
  2207.   partitions to directories with a fairly well known size such as swap,
  2208.   /tmp and /var/tmp and group together the remainders into the remaining
  2209.   partitions using symbolic links.
  2210.  
  2211.   Example: a slow disk (slowdisk), a fast disk (fastdisk) and an
  2212.   assortment of files. Having set up swap and tmp on fastdisk; and /home
  2213.   and root on slowdisk we have (the fictitious) directories /a/slow,
  2214.   /a/fast, /b/slow and /b/fast left to allocate on the partitions
  2215.   /mnt.slowdisk and /mnt.fastdisk which represents the remaining
  2216.   partitions of the two drives.
  2217.  
  2218.   Putting /a or /b directly on either drive gives the same properties to
  2219.   the subdirectories. We could make all 4 directories separate
  2220.   partitions but would lose some flexibility in managing the size of
  2221.   each directory. A better solution is to make these 4 directories
  2222.   symbolic links to appropriate directories on the respective drives.
  2223.   Thus we make
  2224.  
  2225.        /a/fast point to /mnt.fastdisk/a/fast   or   /mnt.fastdisk/a.fast
  2226.        /a/slow point to /mnt.slowdisk/a/slow   or   /mnt.slowdisk/a.slow
  2227.        /b/fast point to /mnt.fastdisk/b/fast   or   /mnt.fastdisk/b.fast
  2228.        /b/slow point to /mnt.slowdisk/b/slow   or   /mnt.slowdisk/b.slow
  2229.  
  2230.   and we get all fast directories on the fast drive without having to
  2231.   set up a partition for all 4 directories. The second (right hand)
  2232.   alternative gives us a flatter files system which in this case can
  2233.   make it simpler to keep an overview of the structure.
  2234.  
  2235.   The disadvantage is that it is a complicated scheme to set up and plan
  2236.   in the first place and that all mount point and partitions have to be
  2237.   defined before the system installation.
  2238.  
  2239.   9.  Implementation
  2240.  
  2241.   Having done the layout you should now have a detailled description on
  2242.   what goes where. Most likely this will be on paper but hopefully
  2243.   someone will make a more automated system that can deal with
  2244.   everything from the design, through partitioning to formatting and
  2245.   installation. This is the route one will have to take to realise the
  2246.   design.
  2247.  
  2248.   Modern distributions come with installation tools that will guide you
  2249.   through partitioning and formatting and also set up /etc/fstab for you
  2250.   automatically. For later modifications, however, you will need to
  2251.   understand the underlying mechanisms.
  2252.  
  2253.   9.1.  Drives and Partitions
  2254.  
  2255.   When you start DOS or the like you will find all partitions labeled C:
  2256.   and onwards, with no differentiation on IDE, SCSI, network or whatever
  2257.   type of media you have. In the world of Linux this is rather
  2258.   different. During booting you will see partitions described like this:
  2259.  
  2260.   ______________________________________________________________________
  2261.   Dec  6 23:45:18 demos kernel: Partition check:
  2262.   Dec  6 23:45:18 demos kernel:  sda: sda1
  2263.   Dec  6 23:45:18 demos kernel:  hda: hda1 hda2
  2264.   ______________________________________________________________________
  2265.  
  2266.   SCSI drives are labelled sda, sdb, sdc etc, and (E)IDE drives are
  2267.   labelled hda, hdb, hdc etc.  There are also standard names for all
  2268.   devices, full information can be found in /dev/MAKEDEV and
  2269.   /usr/src/linux/Documentation/devices.txt.
  2270.  
  2271.   Partitions are labelled numerically for each drive hda1, hda2 and so
  2272.   on.  On SCSI drives there can be 15 partitions per drive, on EIDE
  2273.   drives there can be 63 partitions per drive. Both limits exceed what
  2274.   is currently useful for most disks.
  2275.  
  2276.   These are then mounted according to the file /etc/fstab before they
  2277.   appear as a part of the file system.
  2278.   9.2.  Partitioning
  2279.  
  2280.   First you have to partition each drive into a number of separate
  2281.   partitions.  Under Linux there are two main methods, fdisk and the
  2282.   more screen oriented cfdisk. These are complex programs, read the
  2283.   manual very carefully. Under DOS there are other choices, mainly the
  2284.   version of fdisk that is bundled with for instance DOS, or fips. The
  2285.   latter has the unique advantage here that it can repartition a drive
  2286.   without necessarily damaging existing data, unlike all the other
  2287.   partitioning programs.
  2288.  
  2289.   In order to get the most out of fips you should first defragment your
  2290.   drive. This way you can allocate more space to other partitions.
  2291.  
  2292.   Nevertheless, it is important you do a full backup of all your valued
  2293.   data before partitioning.
  2294.  
  2295.   Partitions come in 3 flavours, primary, extended and logical.  You
  2296.   have to use primary partitions for booting, but there is a maximum of
  2297.   4 primary partitions. If you want more you have to define an extended
  2298.   partition within which you define your logical partitions.
  2299.  
  2300.   Each partition has an identifier number which tells the operating
  2301.   system what it is, for Linux the types swap and ext2fs are the ones
  2302.   you will need to know.
  2303.  
  2304.   There is a readme file that comes with fdisk that gives more in-depth
  2305.   information on partitioning.
  2306.  
  2307.   Someone has just made a Partitioning HOWTO which contains excellent,
  2308.   in depth information on the nitty-gritty of partitioning. Rather than
  2309.   repeating it here and bloating this document further, I will instead
  2310.   refer you to it instead.
  2311.  
  2312.   9.3.  Multiple devices (md)
  2313.  
  2314.   Being in a state of flux you should make sure to read the latest
  2315.   documentation on this kernel feature. It is not yet stable, beware.
  2316.  
  2317.   Briefly explained it works by adding partitions together into new
  2318.   devices md0, md1 etc. using mdadd before you activate them using
  2319.   mdrun. This process can be automated using the file /etc/mdtab.
  2320.  
  2321.   Then you then treat these like any other partition on a drive. Proceed
  2322.   with formatting etc. as described below using these new devices.
  2323.  
  2324.   There is now also a HOWTO in development for RAID using md you should
  2325.   read.
  2326.  
  2327.   9.4.  Formatting
  2328.  
  2329.   Next comes partition formatting, putting down the data structures that
  2330.   will describe the files and where they are located. If this is the
  2331.   first time it is recommended you use formatting with verify. Strictly
  2332.   speaking it should not be necessary but this exercises the I/O hard
  2333.   enough that it can uncover potential problems, such as incorrect
  2334.   termination, before you store your precious data. Look up the command
  2335.   mkfs for more details.
  2336.  
  2337.   Linux can support a great number of file systems, rather than
  2338.   repeating the details you can read the manpage for fs which describes
  2339.   them in some details. Note that your kernel has to have the drivers
  2340.   compiled in or made as modules in order to be able to use these
  2341.   features. When the time comes for kernel compiling you should read
  2342.   carefully through the file system feature list. If you use make
  2343.   menuconfig you can get online help for each file system type.
  2344.  
  2345.   Note that some rescue disk systems require minix, msdos and ext2fs to
  2346.   be compiled into the kernel.
  2347.  
  2348.   Also swap partitions have to be prepared, and for this you use mkswap.
  2349.  
  2350.   9.5.  Mounting
  2351.  
  2352.   Data on a partition is not available to the file system until it is
  2353.   mounted on a mount point. This can be done manually using mount or
  2354.   automatically during booting by adding appropriate lines to
  2355.   /etc/fstab. Read the manual for mount and pay close attention to the
  2356.   tabulation.
  2357.  
  2358.   10.  Maintenance
  2359.  
  2360.   It is the duty of the system manager to keep an eye on the drives and
  2361.   partitions. Should any of the partitions overflow, the system is
  2362.   likely to stop working properly, no matter how much space is available
  2363.   on other partitions, until space is reclaimed.
  2364.  
  2365.   Partitions and disks are easily monitored using df and should be done
  2366.   frequently, perhaps using a cron job or some other general system
  2367.   management tool.
  2368.  
  2369.   Do not forget the swap partitions, these are best monitored using one
  2370.   of the memory statistics programs such as free, procinfo or top.
  2371.  
  2372.   Drive usage monitoring is more difficult but it is important for the
  2373.   sake of performance to avoid contention - placing too much demand on a
  2374.   single drive if others are available and idle.
  2375.  
  2376.   It is important when installing software packages to have a clear idea
  2377.   where the various files go. As previously mentioned GCC keeps binaries
  2378.   in a library directory and there are also other programs that for
  2379.   historical reasons are hard to figure out, X11 for instance has an
  2380.   unusually complex structure.
  2381.  
  2382.   When your system is about to fill up it is about time to check and
  2383.   prune old logging messages as well as hunt down core files. Proper use
  2384.   of ulimit in global shell settings can help saving you from having
  2385.   core files littered around the system.
  2386.  
  2387.   10.1.  Backup
  2388.  
  2389.   The observant reader might have noticed a few hints about the
  2390.   usefulness of making backups. Horror stories are legio about accidents
  2391.   and what happened to the person responsible when the backup turned out
  2392.   to be non-functional or even non existent. You might find it simpler
  2393.   to invest in proper backups than a second, secret identity.
  2394.  
  2395.   There are many options and also a mini-HOWTO ( Backup-With-MSDOS )
  2396.   detailling what you need to know. In addition to the DOS specifics it
  2397.   also contains general information and further leads.
  2398.  
  2399.   In addition to making these backups you should also make sure you can
  2400.   restore the data. Not all systems verify that the data written is
  2401.   correct and many administrators have started restoring the system
  2402.   after an accident happy in the belief that everything is working, only
  2403.   to discover to their horror that the backups were useless. Be careful.
  2404.  
  2405.   10.2.  Defragmentation
  2406.  
  2407.   This is very dependent on the file system design, some suffer fast and
  2408.   nearly debilitating fragmentation. Fortunately for us, ext2fs does not
  2409.   belong to this group and therefore there has been very little talk
  2410.   about making a defragmentation tool.
  2411.  
  2412.   If for some reason you feel this is necessary, the quick and easy
  2413.   solution is to do a backup and a restore. If only a small area is
  2414.   affected, for instance the home directories, you could tar it over to
  2415.   a temporary area on another partition, verify the archive, delete the
  2416.   original and then untar it back again.
  2417.  
  2418.   10.3.  Deletions
  2419.  
  2420.   Quite often disk space shortages can be remedied simply by deleting
  2421.   unnecessary files that accumulate around the system. Quite often
  2422.   programs that terminate abnormally cause all kinds of mess lying
  2423.   around the oddest places. Normally a core dump results after such an
  2424.   incident and unless you are going to debug it you can simply delete
  2425.   it. These can be found everywhere so you are advised to do a global
  2426.   search for them now and then.
  2427.  
  2428.   Unexpected termination can also cause all sorts of temporary files
  2429.   remaining in places like /tmp or /var/tmp, files that are
  2430.   automatically removed when the program ends normally. Rebooting cleans
  2431.   up some of these areas but not necessary all and if you have a long
  2432.   uptime you could end up with a lot of old junk. If space is short you
  2433.   have to delete with care, make sure the file is not in active use
  2434.   first. Utilities like file can often tell you what kind of file you
  2435.   are looking at.
  2436.  
  2437.   Many things are logged when the system is running, mostly to files in
  2438.   the /var/log area. In particular the file /var/log/messages tends to
  2439.   grow until deleted. It is a good idea to keep a small archive of old
  2440.   log files around for comparison should the system start to behave
  2441.   oddly.
  2442.  
  2443.   If the mail or news system is not working properly you could have
  2444.   excessive growth in their spool areas, /var/spool/mail and
  2445.   /var/spool/news respectively. Beware of the overview files as these
  2446.   have a leading dot which makes them invisible to ls -l, it is always
  2447.   better to use ls -Al which will reveal them.
  2448.  
  2449.   User space overflow is a particularly tricky topic. Wars have been
  2450.   waged between system administrators and users. Tact, diplomacy and a
  2451.   generous budget for new drives is what is needed. Make use of the
  2452.   message-of-the-day feature, information displayed during login from
  2453.   the /etc/motd file to tell users when space is short.  Setting the
  2454.   default shell settings to prevent core files being dumped can save you
  2455.   a lot of work too.
  2456.  
  2457.   Certain kinds of people try to hide files around the system, usually
  2458.   trying to take advantage of the fact that files with a leading dot in
  2459.   the name are invisible to the ls command.  One common example are
  2460.   files that look like ... that normally either are not seen, or, when
  2461.   using ls -al disappear in the noise of normal files like . or .. that
  2462.   are in every directory.  There is however a countermeasure to this,
  2463.   use ls -Al that suppresses . or .. but shows all other dot-files.
  2464.  
  2465.   10.4.  Upgrades
  2466.  
  2467.   No matter how large your drives, time will come when you will find you
  2468.   need more. As technology progresses you can get ever more for your
  2469.   money. At the time of writing this, it appears that 5GB drives gives
  2470.   you the most bang for your bucks.
  2471.  
  2472.   Note that with IDE drives you might have to remove an old drive, as
  2473.   the maximum number supported on your mother board is normally only 2
  2474.   or some times 4. With SCSI you can have up to 7 for narrow (8-bit)
  2475.   SCSI or up to 15 for wide (15 bit) SCSI, per channel. Some host
  2476.   adapters can support more than a single channel and in any case you
  2477.   can have more than one host adapter per system. My personal
  2478.   recommendation is that you will most likely be better off with SCSI in
  2479.   the long run.
  2480.  
  2481.   The question comes, where should you put this new drive? In many cases
  2482.   the reason for expansion is that you want a larger spool area, and in
  2483.   that case the fast, simple solution is to mount the drive somewhere
  2484.   under /var/spool. On the other hand newer drives are likely to be
  2485.   faster than older ones so in the long run you might find it worth your
  2486.   time to do a full reorganizing, possibly using your old design sheets.
  2487.  
  2488.   If the upgrade is forced by running out of space in partitions used
  2489.   for things like /usr or /var the upgrade is a little more involved.
  2490.   You might consider the option of a full re-installation from your
  2491.   favourite (and hopefully upgraded) distribution. In this case you will
  2492.   have to be careful not to overwrite your essential setups. Usually
  2493.   these things are in the /etc directory. Proceed with care, fresh
  2494.   backups and working rescue disks. The other possibility is to simply
  2495.   copy the old directory over to the new directory which is mounted on a
  2496.   temporary mount point, edit your /etc/fstab file, reboot with your new
  2497.   partition in place and check that it works.  Should it fail you can
  2498.   reboot with your rescue disk, re-edit /etc/fstab and try again.
  2499.  
  2500.   Until volume management becomes available to Linux this is both
  2501.   complicated and dangerous. Do not get too surprised if you discover
  2502.   you need to restore your system from a backup.
  2503.  
  2504.   The Tips-HOWTO gives the following example on how to move an entire
  2505.   directory structure across:
  2506.  
  2507.   ______________________________________________________________________
  2508.   (cd /source/directory; tar cf - . ) | (cd /dest/directory; tar xvfp -)
  2509.   ______________________________________________________________________
  2510.  
  2511.   While this approach to moving directory trees is portable among many
  2512.   Unix systems, it is inconvenient to remember. Also, it fails for
  2513.   deeply nested directory trees when pathnames become to long to handle
  2514.   for tar (GNU tar has special provisions to deal with long pathnames).
  2515.  
  2516.   If you have access to GNU cp (which is always the case on Linux
  2517.   systems), you could as well use
  2518.  
  2519.   ______________________________________________________________________
  2520.   cp -av /source/directory /dest/directory
  2521.   ______________________________________________________________________
  2522.  
  2523.   GNU cp knows specifically about symbolic links, FIFOs and device files
  2524.   and will copy them correctly.
  2525.  
  2526.   11.  Advanced Issues
  2527.  
  2528.   Linux and related systems offer plenty of possibilities for fast,
  2529.   efficient and devastating destruction. This document is no exception.
  2530.   With power comes dangers and the following sections describe a few
  2531.   more esoteric issues that should not be attempted before reading and
  2532.   understanding the documentation, the issues and the dangers. You
  2533.   should also make a backup. Also remember to try to restore the system
  2534.   from scratch from your backup at least once.  Otherwise you might not
  2535.   be the first to be found with a perfect backup of your system and no
  2536.   tools available to reinstall it (or, even more embarrassing, some
  2537.   critical files missing on tape).
  2538.  
  2539.   The techniques described here are rarely necessary but can be used for
  2540.   very specific setups. Think very clearly through what you wish to
  2541.   accomplish before playing around with this.
  2542.  
  2543.   11.1.  Hard Disk Tuning
  2544.  
  2545.   The hard drive parameters can be tuned using the hdparms utility. Here
  2546.   the most interesting parameter is probably the read-ahead parameter
  2547.   which determines how much prefetch should be done in sequential
  2548.   reading.
  2549.  
  2550.   If you want to try this out it makes most sense to tune for the
  2551.   characteristic file size on your drive but remember that this tuning
  2552.   is for the entire drive which makes it a bit more difficult. Probably
  2553.   this is only of use on large servers using dedicated news drives etc.
  2554.  
  2555.   11.2.  File System Tuning
  2556.  
  2557.   Most file systems come with a tuning utility and for ext2fs there is
  2558.   the tune2fs utility. Several parameters can be modified but perhaps
  2559.   the most useful parameter here is what size should be reserved and who
  2560.   should be able to take advantage of this which could help you getting
  2561.   more useful space out of your drives, possibly at the cost of less
  2562.   room for repairing a system should it crash.
  2563.  
  2564.   11.3.  Spindle Synchronizing
  2565.  
  2566.   This should not in itself be dangerous, other than the peculiar fact
  2567.   that the exact details of the connections remain unclear for many
  2568.   drives. The theory is simple: keeping a fixed phase difference between
  2569.   the different drives in a RAID setup makes for less waiting for the
  2570.   right track to come into position for the read/write head. In practice
  2571.   it now seems that with large read-ahead buffers in the drives the
  2572.   effect is negligible.
  2573.  
  2574.   12.  Further Information
  2575.  
  2576.   There is wealth of information one should go through when setting up a
  2577.   major system, for instance for a news or general Internet service
  2578.   provider.  The FAQs in the following groups are useful:
  2579.  
  2580.   12.1.  News groups
  2581.  
  2582.   Some of the most interesting news groups are:
  2583.  
  2584.   ╖  Storage <news:comp.arch.storage>.
  2585.  
  2586.   ╖  PC storage <news:comp.sys.ibm.pc.hardware.storage>.
  2587.  
  2588.   ╖  AFS <news:alt.filesystems.afs>.
  2589.  
  2590.   ╖  SCSI <news:comp.periphs.scsi>.
  2591.  
  2592.   ╖  Linux setup <news:comp.os.linux.setup>.
  2593.  
  2594.   Most newsgroups have their own FAQ that are designed to answer most of
  2595.   your questions, as the name Frequently Asked Questions indicate. Fresh
  2596.   versions should be posted regularly to the relevant newsgroups. If you
  2597.   cannot find it in your news spool you could go directly to the FAQ
  2598.   main archive FTP site <ftp://rtfm.mit.edu>. The WWW versions can be
  2599.   browsed at FAQ main archive WWW site <http://www.cis.ohio-
  2600.   state.edu/hypertext/faq/usenet/FAQ-List.html>.
  2601.  
  2602.   Some FAQs have their own home site, of particular interest here are
  2603.   SCSI FAQ <http://www.paranoia.com/~filipg/HTML/LINK/F_SCSI.html> and
  2604.   comp.arch.storage FAQ
  2605.   <http://alumni.caltech.edu/~rdv/comp_arch_storage/FAQ-1.html>.
  2606.  
  2607.   12.2.  Mailing lists
  2608.  
  2609.   These are low noise channels mainly for developers. Think twice before
  2610.   asking questions there as noise delays the development.  Some relevant
  2611.   lists are linux-raid, linux-scsi and linux-ext2fs.  Many of the most
  2612.   useful mailing lists run on the vger.rutgers.edu server but this is
  2613.   notoriously overloaded, so try to find a mirror. There are some lists
  2614.   mirrored at The Redhat Home Page <http://www.redhat.com>.  Many lists
  2615.   are also accessible at linuxhq <http://www.linuxhq.com/lnxlists>, and
  2616.   the rest of the web site is a gold mine of useful information.
  2617.  
  2618.   If you want to find out more about the lists available you can send a
  2619.   message with the line lists to the list server at vger.rutgers.edu
  2620.   <mailto:majordomo@vger.rutgers.edu>.  If you need help on how to use
  2621.   the mail server just send the line help to the same address.  Due to
  2622.   the popularity of this server it is likely it takes a bit to time
  2623.   before you get a reply or even get messages after you send a subscribe
  2624.   command.
  2625.  
  2626.   There is also a number of other majordomo list servers that can be of
  2627.   interest such as the EATA driver list <mailto:linux-eata@mail.uni-
  2628.   mainz.de> and the Intelligent IO list <mailto:linux-i2o@dpt.com>.
  2629.  
  2630.   Mailing lists are in a state of flux but you can find links to a
  2631.   number of interesting lists from the Linux Documentation Homepage
  2632.   <http://sunsite.unc.edu/LDP>.
  2633.  
  2634.   12.3.  HOWTO
  2635.  
  2636.   These are intended as the primary starting points to get the
  2637.   background information as well as show you how to solve a specific
  2638.   problem.  Some relevant HOWTOs are Bootdisk, Installation,  SCSI and
  2639.   UMSDOS.  The main site for these is the LDP archive
  2640.   <http://sunsite.unc.edu/LDP> at Sunsite.
  2641.  
  2642.   12.4.  Mini-HOWTO
  2643.  
  2644.   These are the smaller free text relatives to the HOWTOs.  Some
  2645.   relevant mini-HOWTOs are Backup-With-MSDOS, Diskless, LILO,
  2646.   Linux+DOS+Win95+OS2, Linux+OS2+DOS, Linux+Win95, NFS-Root,
  2647.   Win95+Win+Linux, ZIP Drive .  You can find these at the same place as
  2648.   the HOWTOs, usually in a sub directory called mini. Note that these
  2649.   are scheduled to be converted into SGML and become proper HOWTOs in
  2650.   the near future.
  2651.  
  2652.   The old Linux Large IDE mini-HOWTO is no longer valid, instead read
  2653.   /usr/src/linux/drivers/block/README.ide or
  2654.   /usr/src/linux/Documentation/ide.txt.
  2655.  
  2656.   12.5.  Local resources
  2657.  
  2658.   In most distributions of Linux there is already a document directory
  2659.   already, have a look in the document archive <file:///usr/doc> where
  2660.   most packages store their main documentation and README files etc.
  2661.   Also you will here find the HOWTO archive <file:///usr/doc/HOWTO> of
  2662.   ready formatted HOWTOs and also the mini-HOWTO archive
  2663.   <file:///usr/doc/HOWTO/mini> of plain text documents.
  2664.  
  2665.   Many of the configuration files mentioned earlier can be found in the
  2666.   etc <file:///etc> directory. In particular you will want to work with
  2667.   the fstab <file:///etc/fstab> file that sets up the mounting of
  2668.   partitions and possibly also mdtab <file:///etc/mdtab> file that is
  2669.   used for the md system to set up RAID.
  2670.  
  2671.   The kernel source <file:///usr/src/linux> is, of course, the ultimate
  2672.   documentation. In other words, use the source, Luke.  It should also
  2673.   be pointed out that the kernel comes not only with source code which
  2674.   is even commented (well, partially at least) but also an informative
  2675.   documentation directory <file:///usr/src/linux/Documentation>.  If you
  2676.   are about to ask any questions about the kernel you should read this
  2677.   first, it will save you and many others a lot of time and possibly
  2678.   embarrassment.
  2679.  
  2680.   Also have a look in your system log file <file:///var/log/messages> to
  2681.   see what is going on and in particular how the booting went if too
  2682.   much scrolled off your screen. Using tail -f /var/log/messages in a
  2683.   separate window or screen will give you a continuous update of what is
  2684.   going on in your system.
  2685.  
  2686.   You can also take advantage of the /proc <file:///proc> file system
  2687.   that is a window into the inner workings of your system.  Use cat
  2688.   rather than more to view the files as they are reported as being zero
  2689.   length.
  2690.  
  2691.   Much of the work here is based on the Filesystem Structure Standard
  2692.   (FSSTND).  It has changed name to File Hierarchy Standard (FHS) and is
  2693.   less Linux specific.  The maintainer has set up a home page
  2694.   <http://www.pathname.com/fhs> which tells you how to join the
  2695.   currently private mailing list, where the development takes place.
  2696.  
  2697.   12.6.  Web pages
  2698.  
  2699.   There is a huge number of informative web pages out there and by their
  2700.   very nature they change quickly so don't be too surprised if these
  2701.   links become quickly outdated.
  2702.  
  2703.   ╖  Mike Neuffer, the author of the DPT caching RAID controller
  2704.      drivers, has some interesting pages on SCSI <http://www.uni-
  2705.      mainz.de/~neuffer/scsi> and DPT <http://www.uni-
  2706.      mainz.de/~neuffer/scsi/dpt>.
  2707.  
  2708.   ╖  Software RAID 1 development information can be found at RAID 1
  2709.      development page <http://www.nuclecu.unam.mx/~miguel/raid>.
  2710.  
  2711.   ╖  Disk related information on benchmarking, RAID, reliability and
  2712.      much, much more can be found at Linas Vepstas <http://linas.org>
  2713.      project page.
  2714.  
  2715.   ╖  Mark D. Roth has information on VPS
  2716.      <http://www.uiuc.edu/ph/www/roth>
  2717.  
  2718.   ╖  A similar kind of project on an Enhanced File System
  2719.      <http://www.virtual.net.au/~rjh/enh-fs.html>
  2720.  
  2721.   ╖  People who are awaiting support for VFAT32 and Joliet could have a
  2722.      look at the development page
  2723.      <http://bmrc.berkeley.edu/people/chaffee/index.html> for a preview.
  2724.      These drivers are now entering the 2.1.x kernel development series.
  2725.  
  2726.   For diagrams and information on all sorts of disk drives, controllers
  2727.   etc. both for current and discontinued lines The Ref
  2728.   <http://theref.c3d.rl.af.mil> is the site you need. There is a lot of
  2729.   useful information here, a real treasure trove.  You can also download
  2730.   the database using FTP <ftp://theref.c3d.rl.af.mil/public>.
  2731.  
  2732.   Please let me know if you have any other leads that can be of
  2733.   interest.
  2734.  
  2735.   12.7.  Search engines
  2736.  
  2737.   Remember you can also use the web search engines and that some, like
  2738.  
  2739.   ╖  Altavista <http://www.altavista.digital.com>
  2740.  
  2741.   ╖  Excite <http://www.excite.com>
  2742.  
  2743.   ╖  Hotbot <http://www.hotbot.com>
  2744.  
  2745.      can also search usenet news.
  2746.  
  2747.   Also remember that Dejanews <http://www.dejanews.com> is a dedicated
  2748.   news searcher that keeps a news spool from early 1995 and onwards.
  2749.  
  2750.   If you have to ask for help you are most likely to get help in the
  2751.   comp.os.linux.setup news group. Due to large workload and a slow
  2752.   network connection I am not able to follow that newsgroup so if you
  2753.   want to contact me you have to do so by e-mail.
  2754.  
  2755.   13.  Getting Help
  2756.  
  2757.   In the end you might find yourself unable to solve your problems and
  2758.   need help from someone else. The most efficient way is either to ask
  2759.   someone local or in your nearest Linux user group, search the web for
  2760.   the nearest one.
  2761.  
  2762.   Another possibility is to ask on Usenet News in one of the many, many
  2763.   newsgroups available. The problem is that these have such a high
  2764.   volume and noise (called low signal-to-noise ratio) that your question
  2765.   can easily fall through unanswered.
  2766.  
  2767.   No matter where you ask it is important to ask well or you will not be
  2768.   taken seriously. Saying just my disk does not work is not going to
  2769.   help you and instead the noise level is increased even further and if
  2770.   you are lucky someone will ask you to clarify.
  2771.  
  2772.   Instead you are recommended to describe your problems in some detail
  2773.   that will enable people to help you. The problem could lie somewhere
  2774.   you did not expect. Therefore you are advised to list up the following
  2775.   information on your system:
  2776.  
  2777.      Hardware
  2778.  
  2779.      ╖  Processor
  2780.  
  2781.      ╖  Chip set (Triton, Saturn etc)
  2782.  
  2783.      ╖  Bus (ISA, VESA, PCI etc)
  2784.  
  2785.      ╖  Expansion cards used (Disk controllers, video, io etc)
  2786.  
  2787.      Software
  2788.  
  2789.      ╖  BIOS (On motherboard and possibly SCSI host adapters)
  2790.  
  2791.      ╖  LILO, if used
  2792.  
  2793.      ╖  Linux kernel version as well as possible modifications and
  2794.         patches
  2795.  
  2796.      ╖  Kernel parameters, if any
  2797.  
  2798.      ╖  Software that shows the error (with version number or date)
  2799.  
  2800.      Peripherals
  2801.  
  2802.      ╖  Type of disk drives with manufacturer name, version and type
  2803.  
  2804.      ╖  Other relevant peripherals connected to the same busses
  2805.  
  2806.   As an example of how interrelated these problems are: an old chip set
  2807.   caused problems with a certain combination of video controller and
  2808.   SCSI host adapter.
  2809.  
  2810.   Remember that booting text is logged to /var/log/messages which can
  2811.   answer most of the questions above. Obviously if the drives fail you
  2812.   might not be able to get  the log saved to disk but you can at least
  2813.   scroll back up the screen using the SHIFT and PAGE UP keys. It may
  2814.   also be useful to include part of this in you request for help but do
  2815.   not go overboard, keep it brief as a complete log file dumped to
  2816.   Usenet News is more than a little annoying.
  2817.  
  2818.   14.  Concluding Remarks
  2819.  
  2820.   Disk tuning and partition decisions are difficult to make, and there
  2821.   are no hard rules here. Nevertheless it is a good idea to work more on
  2822.   this as the payoffs can be considerable. Maximizing usage on one drive
  2823.   only while the others are idle is unlikely to be optimal, watch the
  2824.   drive light, they are not there just for decoration. For a properly
  2825.   set up system the lights should look like Christmas in a disco. Linux
  2826.   offers software RAID but also support for some hardware base SCSI RAID
  2827.   controllers. Check what is available. As your system and experiences
  2828.   evolve you are likely to repartition and you might look on this
  2829.   document again. Additions are always welcome.
  2830.  
  2831.   14.1.  Coming Soon
  2832.  
  2833.   There are a few more important things that are about to appear here.
  2834.   In particular I will add more example tables as I am about to set up
  2835.   two fairly large and general systems, one at work and one at home.
  2836.   These should give some general feeling on how a system can be set up
  2837.   for either of these two purposes. Examples of smooth running existing
  2838.   systems are also welcome.
  2839.  
  2840.   There is also a fair bit of work left to do on the various kinds of
  2841.   file systems and utilities.
  2842.  
  2843.   There will be a big addition on drive technologies coming soon as well
  2844.   as a more in depth description on using fdisk or cfdisk.  The file
  2845.   systems will be beefed up as more features become available as well as
  2846.   more on RAID and what directories can benefit from what RAID level.
  2847.  
  2848.   Recently I received an information pack from DPT, who made the first
  2849.   hardware RAID supported by Linux. Their leaflets now carry the
  2850.   familiar penguin logo to show they support Linux. More in-depth
  2851.   information will come soon.
  2852.  
  2853.   There is some minor overlapping with the Linux Filesystem Structure
  2854.   Standard that I hope to integrate better soon, which will probably
  2855.   mean a big reworking of all the tables at the end of this document.
  2856.   When the new version is released there will be a substantial rewrite
  2857.   of some of the sections in this HOWTO but no release date has been
  2858.   announced yet.
  2859.  
  2860.   When the new standard appear various details such as directory names,
  2861.   sizes and file placements will be changed.
  2862.  
  2863.   I have made the assumption that the first partition starts at track 0
  2864.   and that this track is the innermost track. That, however, is looking
  2865.   more and more like an unwarranted assumption, and not only because of
  2866.   the logical re-mapping that takes place. More on this when information
  2867.   becomes available.
  2868.  
  2869.   As more people start reading this I should get some more comments and
  2870.   feedback. I am also thinking of making a program that can automate a
  2871.   fair bit of this decision making process and although it is unlikely
  2872.   to be optimum it should provide a simpler, more complete starting
  2873.   point.
  2874.  
  2875.   14.2.  Request for Information
  2876.  
  2877.   It has taken a fair bit of time to write this document and although
  2878.   most pieces are beginning to come together there are still some
  2879.   information needed before we are out of the beta stage.
  2880.  
  2881.   ╖  More information on swap sizing policies is needed as well as
  2882.      information on the largest swap size possible under the various
  2883.      kernel versions.
  2884.  
  2885.   ╖  How common is drive or file system corruption? So far I have only
  2886.      heard of problems caused by flaky hardware.
  2887.  
  2888.   ╖  References to speed and drives is needed.
  2889.  
  2890.   ╖  Are any other Linux compatible RAID controllers available?
  2891.  
  2892.   ╖  Leads to file system, volume management and other related software
  2893.      is welcome.
  2894.  
  2895.   ╖  What relevant monitoring, management and maintenance tools are
  2896.      available?
  2897.  
  2898.   ╖  General references to information sources are needed, perhaps this
  2899.      should be a separate document?
  2900.  
  2901.   ╖  Usage of /tmp and /var/tmp has been hard to determine, in fact what
  2902.      programs use which directory is not well defined and more
  2903.      information here is required. Still, it seems at least clear that
  2904.      these should reside on different physical drives in order to
  2905.      increase parallelicity.
  2906.  
  2907.   14.3.  Suggested Project Work
  2908.  
  2909.   Now and then people post on comp.os.linux.*, looking for good project
  2910.   ideas. Here I will list a few that comes to mind that are relevant to
  2911.   this document. Plans about big projects such as new file systems
  2912.   should still be posted in order to either find co-workers or see if
  2913.   someone is already working on it.
  2914.  
  2915.      Planning tools
  2916.         that can automate the design process outlines earlier would
  2917.         probably make a medium sized project, perhaps as an exercise in
  2918.         constraint based programming.
  2919.  
  2920.      Partitioning tools
  2921.         that take the output of the previously mentioned program and
  2922.         format drives in parallel and apply the appropriate symbolic
  2923.         links to the directory structure. It would probably be best if
  2924.         this were integrated in existing system installation software.
  2925.         The drive partitioning setup used in Solaris is an example of
  2926.         what it can look like.
  2927.  
  2928.      Surveillance tools
  2929.         that keep an eye on the partition sizes and warn before a
  2930.         partition overflows.
  2931.  
  2932.      Migration tools
  2933.         that safely lets you move old structures to new (for instance
  2934.         RAID) systems. This could probably be done as a shell script
  2935.         controlling a back up program and would be rather simple. Still,
  2936.         be sure it is safe and that the changes can be undone.
  2937.  
  2938.   15.  Questions and Answers
  2939.  
  2940.   This is just a collection of what I believe are the most common
  2941.   questions people might have. Give me more feedback and I will turn
  2942.   this section into a proper FAQ.
  2943.  
  2944.   ╖  Q:How many physical disk drives (spindles) does a Linux system
  2945.      need?
  2946.  
  2947.      A: Linux can run just fine on one drive (spindle).  Having enough
  2948.      RAM (around 32 MB, and up to 64 MB) to support swapping is a better
  2949.      price/performance choice than getting a second disk.  (E)IDE disk
  2950.      is usually cheaper (but a little slower) than SCSI.
  2951.  
  2952.   ╖  Q: I have a single drive, will this HOWTO help me?
  2953.  
  2954.      A: Yes, although only to a minor degree. Still, the section on
  2955.      ``Physical Track Positioning'' will offer you some gains.
  2956.  
  2957.   ╖  Q: Are there any disadvantages in this scheme?
  2958.  
  2959.      A: There is only a minor snag: if even a single partition overflows
  2960.      the system might stop working properly. The severity depends of
  2961.      course on what partition is affected. Still this is not hard to
  2962.      monitor, the command df gives you a good overview of the situation.
  2963.      Also check the swap partition(s) using free to make sure you are
  2964.      not about to run out of virtual memory.
  2965.  
  2966.   ╖  Q: OK, so should I split the system into as many partitions as
  2967.      possible for a single drive?
  2968.  
  2969.      A: No, there are several disadvantages to that. First of all
  2970.      maintenance becomes needlessly complex and you gain very little in
  2971.      this. In fact if your partitions are too big you will seek across
  2972.      larger areas than needed.  This is a balance and dependent on the
  2973.      number of physical drives you have.
  2974.  
  2975.   ╖  Q: Does that mean more drives allows more partitions?
  2976.  
  2977.      A: To some degree, yes. Still, some directories should not be split
  2978.      off from root, check out the file system standard (soon released
  2979.      under the name File Hierarchy Standard) for more details.
  2980.  
  2981.   ╖  Q: What if I have many drives I want to use?
  2982.  
  2983.      A: If you have more than 3-4 drives you should consider using RAID
  2984.      of some form. Still, it is a good idea to keep your root partition
  2985.      on a simple partition without RAID, see the section on ``RAID'' for
  2986.      more details.
  2987.  
  2988.   ╖  Q: I have installed the latest Windows95 but cannot access this
  2989.      partition from within the Linux system, what is wrong?
  2990.  
  2991.      A: Most likely you are using FAT32 in your windows partition. It
  2992.      seems that Microsoft decided we needed yet another format, and this
  2993.      was introduced in their latest version of Windows95. The advantage
  2994.      is that this format is better suited to large drives. Unfortunately
  2995.      there is no stable driver for Linux out yet . A test version is out
  2996.      but not yet in the standard kernel.
  2997.  
  2998.      You might also be interested to hear that Microsoft NT 4.0 does not
  2999.      support it yet either.
  3000.  
  3001.      Until a stable version is available you can avoid this problem by
  3002.      installing Windows95 over an existing FAT16 partition, made for
  3003.      instance by an older installation of DOS. This forces the Windows95
  3004.      to use FAT16 which is supported by Linux.
  3005.  
  3006.   ╖  Q: I cannot get the disk size and partition sizes to match,
  3007.      something is missing. What has happened?
  3008.  
  3009.      It is possible you have mounted a partition onto a mount point that
  3010.      was not an empty directory. Mount points are directories and if it
  3011.      is not empty the mounting will mask the contents. If you do the
  3012.      sums you will see the amount of disk space used in this directory
  3013.      is missing from the observed total.
  3014.  
  3015.      To solve this you can boot from a rescue disk and see what is
  3016.      hiding behind your mount points and remove or transfer the contents
  3017.      by mounting th offending partition on a temporary mounting point.
  3018.      You might find it useful to have "spare" emergency mounting points
  3019.      ready made.
  3020.  
  3021.   ╖  Q: What is this nyx that is mentioned several times here?
  3022.  
  3023.      A: It is a large free Unix system with currently about 10000 users.
  3024.      I use it for my web pages for this HOWTO as well as a source of
  3025.      ideas for a setup of large Unix systems. It has been running for
  3026.      many years and has a quite stable setup. For more information you
  3027.      can view the Nyx homepage <http://www.nyx.net> which also gives you
  3028.      information on how to get your own free account.
  3029.  
  3030.   16.  Bits and Pieces
  3031.  
  3032.   This is basically a section where I stuff all the bits I have not yet
  3033.   decided where should go, yet that I feel is worth knowing about. It is
  3034.   a kind of transient area.
  3035.  
  3036.   16.1.  Combining swap and /tmp
  3037.  
  3038.   Recently there have been discussions in the various linux related news
  3039.   groups about specialized file systems for temporary storage.  This is
  3040.   partly inspired by the tmpfs on *BSD* and Solaris, as well as swapfs
  3041.   on the NeXT machines.
  3042.  
  3043.   The rationale is that these are temporary storage that normally does
  3044.   not require much space, yet in normal systems you need to reserve a
  3045.   certain amount of space for these. Elementary statistical knowledge
  3046.   tells you (very simplified) that when you sum a number of variables
  3047.   the relative statistical uncertainty decreases. So combining swap and
  3048.   /tmp you do not need to reserve as much space as you otherwise would
  3049.   need.
  3050.  
  3051.   This specialized file system is nothing more than a swappable RAM disk
  3052.   that are swapped out to disk when and only when space is limited, thus
  3053.   effectively putting temporary files on the swap partition.
  3054.  
  3055.   There is, however, a snag. This scheme prevents you from getting
  3056.   parallel activity on swap and /tmp drives so under heavy activity the
  3057.   system takes a bigger performance hit. Put another way, you trade
  3058.   speed to get space. Interleaving across multiple drives reduces this
  3059.   somewhat.
  3060.  
  3061.   16.2.  Interleaved swap drives.
  3062.  
  3063.   This is not striping across several drives, instead drives are
  3064.   accessed in a round robin fashion in order to spread the load in a
  3065.   crude fashion.  In Linux you additionally have a priority parameter
  3066.   you can adjust for tuning your system, especially useful if your disks
  3067.   differs  significantly in speed. Check man 8 swapon as well as man 2
  3068.   swapon for more information.
  3069.  
  3070.   16.3.  Swap partition: to use or not to use
  3071.  
  3072.   In many cases you do not need a swap partition, for instance if you
  3073.   have plenty of RAM, say, more than 64MB, and you are the sole user of
  3074.   the machine. In this case you can experiment running without a swap
  3075.   partition and check the system logs to see if you ran out of virtual
  3076.   memory at any point.
  3077.  
  3078.   Removing swap partitions have two advantages:
  3079.  
  3080.   ╖  you save disk space (rather obvious really)
  3081.  
  3082.   ╖  you save seek time as swap partitions otherwise would lie in the
  3083.      middle of your disk space.
  3084.  
  3085.   In the end, having a swap partition is like having a heated toilet:
  3086.   you do not use it very often, but you sure appreciate it when you
  3087.   require it.
  3088.  
  3089.   16.4.  Mount point and /mnt
  3090.  
  3091.   In an earlier version of this document I proposed to put all
  3092.   permanently mounted partitions under /mnt. That, however, is not such
  3093.   a good idea as this itself can be used as a mount point, which leads
  3094.   to all mounted partitions becoming unavailable. Instead I will propose
  3095.   mounting straight from root using a meaningful name like
  3096.   /mnt.descriptive-name.
  3097.  
  3098.   Lately I have become aware that some Linux distributions use mount
  3099.   points at subdirectories under /mnt, such as /mnt/floppy and
  3100.   /mnt/cdrom, which just shows how confused the whole issue is.
  3101.   Hopefully FHS should clarify this.
  3102.  
  3103.   16.5.  SCSI id numbers and names
  3104.  
  3105.   Partitions are labeled in the order they are found, not depending on
  3106.   the SCSI id number. This means that if you add a drive with an id
  3107.   number inserted in the previous order of numbers, or change id number
  3108.   in any other way, the partition names will be messed up. This is
  3109.   important if you use removable media. In order to save yourself from
  3110.   some unpleasant experiences, you are recommended to use low numbers
  3111.   for fixed media and reserve the last number(s) for removable media
  3112.   drives.
  3113.  
  3114.   Many have been bitten by this misfeature and there is a strong call
  3115.   for something to be done about it. Nobody knows how soon this will be
  3116.   fixed so in the meantime it is wise to take this into consideration
  3117.   when you design your system. For instance it may be a good idea to use
  3118.   the lowest SCSI id number for you root disk so that it has the least
  3119.   probability of being renumbered should one drive fail.
  3120.  
  3121.   16.6.  Power and Heating
  3122.  
  3123.   Not many years ago a machine with the equivalent power of a modern PC
  3124.   required 3-phase power and cooling, usually by air conditioning the
  3125.   machine room but some times also by water cooling. Technology has
  3126.   progressed very quickly giving not only high speed but also low power
  3127.   components. Still, there is a definite limit to the technology,
  3128.   something one should keep in mind as the system is expanded with yet
  3129.   another disk drive or PCI card. When the power supply is running at
  3130.   full rated power, keep in mind that all this energy is going
  3131.   somewhere, mostly into heat. Unless this is dissipated using fans you
  3132.   will get a serious heating inside the cabinet followed by a reduced
  3133.   reliability and also life time of the electronics.  Manufacturers
  3134.   state minimum cooling requirements for their drives, usually in terms
  3135.   of cubic feet per minute (CFM). You are well advised to take this
  3136.   serious.
  3137.  
  3138.   Keep air flow passages open, clean out dust and check the temperature
  3139.   of your system running. If it is too hot to touch it is probably
  3140.   running too hot.
  3141.  
  3142.   If possible use sequential spin up for the drives. It is during spin
  3143.   up, when the drive platters accelerate up to normal speed, that a
  3144.   drive consumes maximum power and if all drives start up simultaneously
  3145.   you could go beyond the rated power maximum of your power supply.
  3146.  
  3147.   16.7.  Dejanews
  3148.  
  3149.   This is an Internet system that no doubt most of you are familiar
  3150.   with.  It searches and serves Usenet News articles from 1995 and to
  3151.   the latest postings and also offers a web based reading and posting
  3152.   interface.  There is a lot more, check out Dejanews
  3153.   <http://www.dejanews.com> for more information.
  3154.  
  3155.   What perhaps is less known, is that they use about 20 Linux SMP
  3156.   computers each of which uses the md module to manage between 4 and 24
  3157.   Gig of disk space (over 150 Gig altogether) for this service.  The
  3158.   system is continuously growing but at the time of writing they use
  3159.   mostly dual Pentium Pro 200MHz systems with 256M RAM.
  3160.  
  3161.   A production machine normally has 1 disk for the operating system and
  3162.   between 4 and 6 disks managed by the md module where the articles are
  3163.   archived.  The drives are connected to BusLogic Model BT-946C PCI SCSI
  3164.   adapters, usually two to a machine.
  3165.  
  3166.   Just in case: this is not an advertisement, it is stated as an example
  3167.   of how much is required for what is a major Internet service.
  3168.  
  3169.   16.8.  File system structure
  3170.  
  3171.   There are many file system structures in existence, differing with
  3172.   FSSTND (and soon FHS) to varying degree both in terms of philosophy,
  3173.   strategy and implementation. It is not possible to detail all here,
  3174.   instead the interested reader should read the relevant manual page,
  3175.   man hier which is available on many platforms and implementations.
  3176.  
  3177.   16.9.  Track numbering and optimizing schemes
  3178.  
  3179.   In the old days the file system used to take advantage of knowing the
  3180.   physical drive parameters in order to optimize transfers, for instance
  3181.   by endeavouring to keep a file within a single track if possible which
  3182.   saves track-to-track seek time. These days with logical drive
  3183.   parameters, drive cache and schemes to map out bad sectors, such
  3184.   optimizations become meaningless and might even cost more than it
  3185.   would gain. As most Linux installations use modern file systems these
  3186.   schemes are not used, however, some other operating systems have
  3187.   retained such schemes.
  3188.  
  3189.   17.  Appendix A: Partitioning layout table: mounting and linking
  3190.  
  3191.   The following table is designed to make layout a simpler paper and
  3192.   pencil exercise. It is probably best to print it out (using NON
  3193.   PROPORTIONAL fonts) and adjust the numbers until you are happy with
  3194.   them.
  3195.  
  3196.   Mount point is what directory you wish to mount a partition on or the
  3197.   actual device. This is also a good place to note how you plan to use
  3198.   symbolic links.
  3199.  
  3200.   The size given corresponds to a fairly big Debian 1.2.6 installation.
  3201.   Other examples are coming later.
  3202.  
  3203.   Mainly you use this table to select what structure and drives you will
  3204.   use, the partition numbers and letters will come from the next two
  3205.   tables.
  3206.  
  3207.   Directory       Mount point     speed   seek    transfer        size    SIZE
  3208.  
  3209.   swap            __________      ooooo   ooooo   ooooo           32      ____
  3210.  
  3211.   /               __________      o       o       o               20      ____
  3212.  
  3213.   /tmp            __________      oooo    oooo    oooo                    ____
  3214.  
  3215.   /var            __________      oo      oo      oo              25      ____
  3216.   /var/tmp        __________      oooo    oooo    oooo                    ____
  3217.   /var/spool      __________                                              ____
  3218.   /var/spool/mail __________      o       o       o                       ____
  3219.   /var/spool/news __________      ooo     ooo     oo                      ____
  3220.   /var/spool/____ __________      ____    ____    ____                    ____
  3221.  
  3222.   /home           __________      oo      oo      oo                      ____
  3223.  
  3224.   /usr            __________                                      500     ____
  3225.   /usr/bin        __________      o       oo      o               250     ____
  3226.   /usr/lib        __________      oo      oo      ooo             200     ____
  3227.   /usr/local      __________                                              ____
  3228.   /usr/local/bin  __________      o       oo      o                       ____
  3229.   /usr/local/lib  __________      oo      oo      ooo                     ____
  3230.   /usr/local/____ __________                                              ____
  3231.   /usr/src        __________      o       oo      o               50      ____
  3232.  
  3233.   DOS             __________      o       o       o                       ____
  3234.   Win             __________      oo      oo      oo                      ____
  3235.   NT              __________      ooo     ooo     ooo                     ____
  3236.  
  3237.   /mnt._________  __________      ____    ____    ____                    ____
  3238.   /mnt._________  __________      ____    ____    ____                    ____
  3239.   /mnt._________  __________      ____    ____    ____                    ____
  3240.   /_____________  __________      ____    ____    ____                    ____
  3241.   /_____________  __________      ____    ____    ____                    ____
  3242.   /_____________  __________      ____    ____    ____                    ____
  3243.  
  3244.   Total capacity:
  3245.  
  3246.   18.  Appendix B: Partitioning layout table: numbering and sizing
  3247.  
  3248.   This table follows the same logical structure as the table above where
  3249.   you decided what disk to use. Here you select the physical tracking,
  3250.   keeping in mind the effect of track positioning mentioned earlier in
  3251.   ``Physical Track Positioning''.
  3252.  
  3253.   The final partition number will come out of the table after this.
  3254.  
  3255.     Drive           sda     sdb     sdc     hda     hdb     hdc     ___
  3256.  
  3257.   SCSI ID         |  __   |  __   |  __   |
  3258.  
  3259.   Directory
  3260.   swap            |       |       |       |       |       |       |
  3261.  
  3262.   /               |       |       |       |       |       |       |
  3263.  
  3264.   /tmp            |       |       |       |       |       |       |
  3265.  
  3266.   /var            :       :       :       :       :       :       :
  3267.   /var/tmp        |       |       |       |       |       |       |
  3268.   /var/spool      :       :       :       :       :       :       :
  3269.   /var/spool/mail |       |       |       |       |       |       |
  3270.   /var/spool/news :       :       :       :       :       :       :
  3271.   /var/spool/____ |       |       |       |       |       |       |
  3272.  
  3273.   /home           |       |       |       |       |       |       |
  3274.  
  3275.   /usr            |       |       |       |       |       |       |
  3276.   /usr/bin        :       :       :       :       :       :       :
  3277.   /usr/lib        |       |       |       |       |       |       |
  3278.   /usr/local      :       :       :       :       :       :       :
  3279.   /usr/local/bin  |       |       |       |       |       |       |
  3280.   /usr/local/lib  :       :       :       :       :       :       :
  3281.   /usr/local/____ |       |       |       |       |       |       |
  3282.   /usr/src        :       :       :       :
  3283.  
  3284.   DOS             |       |       |       |       |       |       |
  3285.   Win             :       :       :       :       :       :       :
  3286.   NT              |       |       |       |       |       |       |
  3287.  
  3288.   /mnt.___/_____  |       |       |       |       |       |       |
  3289.   /mnt.___/_____  :       :       :       :       :       :       :
  3290.   /mnt.___/_____  |       |       |       |       |       |       |
  3291.   /_____________  :       :       :       :       :       :       :
  3292.   /_____________  |       |       |       |       |       |       |
  3293.   /_____________  :       :       :       :       :       :       :
  3294.  
  3295.   Total capacity:
  3296.  
  3297.   19.  Appendix C: Partitioning layout table: partition placement
  3298.  
  3299.   This is just to sort the partition numbers in ascending order ready to
  3300.   input to fdisk or cfdisk. Here you take physical track positioning
  3301.   into account when finalizing your design. Unless you get specific
  3302.   information otherwise, you can assume track 0 is the outermost track.
  3303.  
  3304.   These numbers and letters are then used to update the previous tables,
  3305.   all of which you will find very useful in later maintenance.
  3306.  
  3307.   In case of disk crash you might find it handy to know what SCSI id
  3308.   belongs to which drive, consider keeping a paper copy of this.
  3309.  
  3310.           Drive :   sda     sdb     sdc     hda     hdb     hdc     ___
  3311.  
  3312.   Total capacity: |  ___  |  ___  |  ___  |  ___  |  ___  |  ___  |  ___
  3313.   SCSI ID         |  __   |  __   |  __   |
  3314.  
  3315.   Partition
  3316.  
  3317.   1               |       |       |       |       |       |       |
  3318.   2               :       :       :       :       :       :       :
  3319.   3               |       |       |       |       |       |       |
  3320.   4               :       :       :       :       :       :       :
  3321.   5               |       |       |       |       |       |       |
  3322.   6               :       :       :       :       :       :       :
  3323.   7               |       |       |       |       |       |       |
  3324.   8               :       :       :       :       :       :       :
  3325.   9               |       |       |       |       |       |       |
  3326.   10              :       :       :       :       :       :       :
  3327.   11              |       |       |       |       |       |       |
  3328.   12              :       :       :       :       :       :       :
  3329.   13              |       |       |       |       |       |       |
  3330.   14              :       :       :       :       :       :       :
  3331.   15              |       |       |       |       |       |       |
  3332.   16              :       :       :       :       :       :       :
  3333.  
  3334.   20.  Appendix D: Example: Multipurpose server
  3335.  
  3336.   The following table is from the setup of a medium sized multipurpose
  3337.   server where I work. Aside from being a general Linux machine it will
  3338.   also be a network related server (DNS, mail, FTP, news, printers etc.)
  3339.   X server for various CAD programs, CD ROM burner and many other
  3340.   things.  The files reside on 3 SCSI drives with a capacity of 600,
  3341.   1000 and 1300 MB.
  3342.  
  3343.   Some further speed could possibly be gained by splitting /usr/local
  3344.   from the rest of the /usr system but we deemed the further added
  3345.   complexity would not be worth it. With another couple of drives this
  3346.   could be more worthwhile. In this setup drive sda is old and slow and
  3347.   could just a well be replaced by an IDE drive. The other two drives
  3348.   are both rather fast. Basically we split most of the load between
  3349.   these two. To reduce dangers of imbalance in partition sizing we have
  3350.   decided to keep /usr/bin and /usr/local/bin in one drive and /usr/lib
  3351.   and /usr/local/lib on another separate drive which also affords us
  3352.   some drive parallelizing.
  3353.  
  3354.   Even more could be gained by using RAID but we felt that as a server
  3355.   we needed more reliability than was then afforded by the md patch and
  3356.   a dedicated RAID controller was out of our reach.
  3357.  
  3358.   21.  Appendix E: Example: mounting and linking
  3359.  
  3360.   Directory       Mount point     speed   seek    transfer        size    SIZE
  3361.  
  3362.   swap            sdb2, sdc2      ooooo   ooooo   ooooo           32      2x64
  3363.  
  3364.   /               sda2            o       o       o               20       100
  3365.  
  3366.   /tmp            sdb3            oooo    oooo    oooo                     300
  3367.  
  3368.   /var            __________      oo      oo      oo                      ____
  3369.   /var/tmp        sdc3            oooo    oooo    oooo                     300
  3370.   /var/spool      sdb1                                                     436
  3371.   /var/spool/mail __________      o       o       o                       ____
  3372.   /var/spool/news __________      ooo     ooo     oo                      ____
  3373.   /var/spool/____ __________      ____    ____    ____                    ____
  3374.  
  3375.   /home           sda3            oo      oo      oo                       400
  3376.  
  3377.   /usr            sdb4                                            230      200
  3378.   /usr/bin        __________      o       oo      o               30      ____
  3379.   /usr/lib        -> libdisk      oo      oo      ooo             70      ____
  3380.   /usr/local      __________                                              ____
  3381.   /usr/local/bin  __________      o       oo      o                       ____
  3382.   /usr/local/lib  -> libdisk      oo      oo      ooo                     ____
  3383.   /usr/local/____ __________                                              ____
  3384.   /usr/src        ->/home/usr.src o       oo      o               10      ____
  3385.  
  3386.   DOS             sda1            o       o       o                        100
  3387.   Win             __________      oo      oo      oo                      ____
  3388.   NT              __________      ooo     ooo     ooo                     ____
  3389.  
  3390.   /mnt.libdisk    sdc4            oo      oo      ooo                      226
  3391.   /mnt.cd         sdc1            o       o       oo                       710
  3392.  
  3393.   Total capacity: 2900 MB
  3394.  
  3395.   22.  Appendix F: Example: numbering and sizing
  3396.  
  3397.   Here we do the adjustment of sizes and positioning.
  3398.  
  3399.   Directory         sda     sdb     sdc
  3400.  
  3401.   swap            |       |   64  |   64  |
  3402.  
  3403.   /               |  100  |       |       |
  3404.  
  3405.   /tmp            |       |  300  |       |
  3406.  
  3407.   /var            :       :       :       :
  3408.   /var/tmp        |       |       |  300  |
  3409.   /var/spool      :       :  436  :       :
  3410.   /var/spool/mail |       |       |       |
  3411.   /var/spool/news :       :       :       :
  3412.   /var/spool/____ |       |       |       |
  3413.  
  3414.   /home           |  400  |       |       |
  3415.  
  3416.   /usr            |       |  200  |       |
  3417.   /usr/bin        :       :       :       :
  3418.   /usr/lib        |       |       |       |
  3419.   /usr/local      :       :       :       :
  3420.   /usr/local/bin  |       |       |       |
  3421.   /usr/local/lib  :       :       :       :
  3422.   /usr/local/____ |       |       |       |
  3423.   /usr/src        :       :       :       :
  3424.  
  3425.   DOS             |  100  |       |       |
  3426.   Win             :       :       :       :
  3427.   NT              |       |       |       |
  3428.  
  3429.   /mnt.libdisk    |       |       |  226  |
  3430.   /mnt.cd         :       :       :  710  :
  3431.   /mnt.___/_____  |       |       |       |
  3432.  
  3433.   Total capacity: |  600  | 1000  | 1300  |
  3434.  
  3435.   23.  Appendix G: Example: partition placement
  3436.  
  3437.   This is just to sort the partition numbers in ascending order ready to
  3438.   input to fdisk or cfdisk. Remember to optimize for physical track
  3439.   positioning (not done here).
  3440.  
  3441.                Drive :   sda     sdb     sdc
  3442.  
  3443.        Total capacity: |   600 |  1000 |  1300 |
  3444.  
  3445.        Partition
  3446.  
  3447.        1               |   100 |   436 |   710 |
  3448.        2               :   100 :    64 :    64 :
  3449.        3               |   400 |   300 |   300 |
  3450.        4               :       :   200 :   226 :
  3451.  
  3452.   24.  Appendix H: Example II
  3453.  
  3454.   The following is an example of a server setup in an academic setting,
  3455.   and is contributed by nakano (at) apm.seikei.ac.jp. I have only done
  3456.   minor editing to this section.
  3457.  
  3458.   /var/spool/delegate is a directory for storing logs and cache files of
  3459.   an WWW proxy server program, "delegated". Since I don't notice it
  3460.   widely, there are 1000--1500 requests/day currently, and average disk
  3461.   usage is 15--30% with expiration of caches each day.
  3462.  
  3463.   /mnt.archive is used for data files which are big and not frequently
  3464.   referenced such a s experimental data (especially graphic ones),
  3465.   various source archives, and Win95 backups (growing very fast...).
  3466.  
  3467.   /mnt.root is backup root file system containing rescue utilities. A
  3468.   boot floppy is also prepared to boot with this partition.
  3469.  
  3470.   =================================================
  3471.   Directory               sda      sdb     hda
  3472.  
  3473.   swap                    |    64 |    64 |       |
  3474.   /                       |       |       |    20 |
  3475.   /tmp                    |       |       |   180 |
  3476.  
  3477.   /var                    :   300 :       :       :
  3478.   /var/tmp                |       |   300 |       |
  3479.   /var/spool/delegate     |   300 |       |       |
  3480.  
  3481.   /home                   |       |       |   850 |
  3482.   /usr                    |   360 |       |       |
  3483.   /usr/lib                -> /mnt.lib/usr.lib
  3484.   /usr/local/lib          -> /mnt.lib/usr.local.lib
  3485.  
  3486.   /mnt.lib                |       |   350 |       |
  3487.   /mnt.archive            :       :  1300 :       :
  3488.   /mnt.root               |       |    20 |       |
  3489.  
  3490.   Total capacity:            1024    2034    1050
  3491.  
  3492.   =================================================
  3493.           Drive :           sda     sdb     hda
  3494.   Total capacity:         |  1024 |  2034 |  1050 |
  3495.  
  3496.   Partition
  3497.   1                       |   300 |    20 |    20 |
  3498.   2                       :    64 :  1300 :   180 :
  3499.   3                       |   300 |    64 |   850 |
  3500.   4                       :   360 :   ext :       :
  3501.   5                       |       |   300 |       |
  3502.   6                       :       :   350 :       :
  3503.  
  3504.   Filesystem         1024-blocks  Used Available Capacity Mounted on
  3505.   /dev/hda1              19485   10534     7945     57%   /
  3506.   /dev/hda2             178598      13   169362      0%   /tmp
  3507.   /dev/hda3             826640  440814   343138     56%   /home
  3508.   /dev/sda1             306088   33580   256700     12%   /var
  3509.   /dev/sda3             297925   47730   234807     17%   /var/spool/delegate
  3510.   /dev/sda4             363272  170872   173640     50%   /usr
  3511.   /dev/sdb5             297598       2   282228      0%   /var/tmp
  3512.   /dev/sdb2            1339248  302564   967520     24%   /mnt.archive
  3513.   /dev/sdb6             323716   78792   228208     26%   /mnt.lib
  3514.  
  3515.   Apparently /tmp and /var/tmp is too big. These directories shall be
  3516.   packed together into one partition when disk space shortage comes.
  3517.  
  3518.   /mnt.lib is also seemed to be, but I plan to install newer TeX and
  3519.   ghostscript archives, so /usr/local/lib may grow about 100M or so
  3520.   (since we must use Japanese fonts!).
  3521.  
  3522.   Whole system is backed up by Seagate Tapestore 8000 (Travan TR-4,
  3523.   4G/8G).
  3524.  
  3525.   25.  Appendix I: Example III: SPARC Solaris
  3526.  
  3527.   The following section is the basic design used at work for a number of
  3528.   Sun SPARC servers running Solaris 2.5.1 in an industrial development
  3529.   environment. It serves a number of database and cad applications in
  3530.   addition to the normal services such as mail.
  3531.  
  3532.   Simplicity is emphasized here so /usr/lib has not been split off from
  3533.   /usr.
  3534.  
  3535.   This is the basic layout, planned for about 100 users.
  3536.  
  3537.           Drive:        SCSI 0                      SCSI 1
  3538.  
  3539.           Partition     Size (MB)   Mount point    Size (MB)   Mount point
  3540.  
  3541.             0           160         swap           160         swap
  3542.             1           100         /tmp           100         /var/tmp
  3543.             2           400         /usr
  3544.             3           100         /
  3545.             4            50         /var
  3546.             5
  3547.             6           remainder   /local0        remainder   /local1
  3548.  
  3549.   Due to specific requirements at this place it is at times necessary to
  3550.   have large partitions available on a short notice. Therefore drive 0
  3551.   is given as many tasks as feasible, leaving a large /local1 partition.
  3552.  
  3553.   This setup has been in use for some time now and found satisfactorily.
  3554.  
  3555.   For a more general and balanced system it would be better to swap /tmp
  3556.   and /var/tmp and then move /var to drive 1.
  3557.  
  3558.